Skip to content

Commit 6781d6a

Browse files
committed
PHP7 fix in nusoap
1 parent fb0aec9 commit 6781d6a

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

framework/vendors/nusoap/nusoap.php

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
* 07/07/2020 - class declaration changed to PHP5-7
5656
* 07/07/2020 - undefined var fix
5757
* 02/10/2020 - removed using of globals array
58+
* 22/01/2021 - $HTTP_SERVER_VARS replaced with $_SERVER
5859
*/
5960

6061
/* load classes
@@ -3625,14 +3626,14 @@ function __construct($wsdl=false){
36253626
parent::nusoap_base();
36263627
// turn on debugging?
36273628
global $debug;
3628-
global $HTTP_SERVER_VARS;
3629+
global $_SERVER;
36293630

36303631
if (isset($_SERVER)) {
36313632
$this->debug("_SERVER is defined:");
36323633
$this->appendDebug($this->varDump($_SERVER));
3633-
} elseif (isset($HTTP_SERVER_VARS)) {
3634+
} elseif (isset($_SERVER)) {
36343635
$this->debug("HTTP_SERVER_VARS is defined:");
3635-
$this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3636+
$this->appendDebug($this->varDump($_SERVER));
36363637
} else {
36373638
$this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
36383639
}
@@ -3648,8 +3649,8 @@ function __construct($wsdl=false){
36483649
$this->debug_flag = substr($v, 6);
36493650
}
36503651
}
3651-
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3652-
$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
3652+
} elseif (isset($_SERVER['QUERY_STRING'])) {
3653+
$qs = explode('&', $_SERVER['QUERY_STRING']);
36533654
foreach ($qs as $v) {
36543655
if (substr($v, 0, 6) == 'debug=') {
36553656
$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
@@ -3681,24 +3682,24 @@ function __construct($wsdl=false){
36813682
/**
36823683
* processes request and returns response
36833684
*
3684-
* @param string $data usually is the value of $HTTP_RAW_POST_DATA
3685+
* @param string $data usually is the value of POST data
36853686
* @access public
36863687
*/
36873688
function service($data){
3688-
global $HTTP_SERVER_VARS;
3689+
global $_SERVER;
36893690

36903691
if (isset($_SERVER['REQUEST_METHOD'])) {
36913692
$rm = $_SERVER['REQUEST_METHOD'];
3692-
} elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
3693-
$rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
3693+
} elseif (isset($_SERVER['REQUEST_METHOD'])) {
3694+
$rm = $_SERVER['REQUEST_METHOD'];
36943695
} else {
36953696
$rm = '';
36963697
}
36973698

36983699
if (isset($_SERVER['QUERY_STRING'])) {
36993700
$qs = $_SERVER['QUERY_STRING'];
3700-
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3701-
$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
3701+
} elseif (isset($_SERVER['QUERY_STRING'])) {
3702+
$qs = $_SERVER['QUERY_STRING'];
37023703
} else {
37033704
$qs = '';
37043705
}
@@ -3769,7 +3770,7 @@ function service($data){
37693770
* @access private
37703771
*/
37713772
function parse_http_headers() {
3772-
global $HTTP_SERVER_VARS;
3773+
global $_SERVER;
37733774

37743775
$this->request = '';
37753776
$this->SOAPAction = '';
@@ -3832,9 +3833,9 @@ function parse_http_headers() {
38323833
$this->request .= "$k: $v\r\n";
38333834
$this->debug("$k: $v");
38343835
}
3835-
} elseif (is_array($HTTP_SERVER_VARS)) {
3836+
} elseif (is_array($_SERVER)) {
38363837
$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3837-
foreach ($HTTP_SERVER_VARS as $k => $v) {
3838+
foreach ($_SERVER as $k => $v) {
38383839
if (substr($k, 0, 5) == 'HTTP_') {
38393840
$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5));
38403841
} else {
@@ -4409,7 +4410,7 @@ function add_to_map($methodname,$in,$out){
44094410
* @access public
44104411
*/
44114412
function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
4412-
global $HTTP_SERVER_VARS;
4413+
global $_SERVER;
44134414

44144415
if($this->externalWSDLURL){
44154416
die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
@@ -4429,11 +4430,11 @@ function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=fa
44294430
if (isset($_SERVER)) {
44304431
$SERVER_NAME = $_SERVER['SERVER_NAME'];
44314432
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4432-
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4433-
} elseif (isset($HTTP_SERVER_VARS)) {
4434-
$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4435-
$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4436-
$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4433+
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off');
4434+
} elseif (isset($_SERVER)) {
4435+
$SERVER_NAME = $_SERVER['SERVER_NAME'];
4436+
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4437+
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off';
44374438
} else {
44384439
$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
44394440
}
@@ -4498,18 +4499,18 @@ function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
44984499
*/
44994500
function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
45004501
{
4501-
global $HTTP_SERVER_VARS;
4502+
global $_SERVER;
45024503

45034504
if (isset($_SERVER)) {
45044505
$SERVER_NAME = $_SERVER['SERVER_NAME'];
45054506
$SERVER_PORT = $_SERVER['SERVER_PORT'];
45064507
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4507-
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4508-
} elseif (isset($HTTP_SERVER_VARS)) {
4509-
$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4510-
$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
4511-
$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4512-
$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4508+
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off');
4509+
} elseif (isset($_SERVER)) {
4510+
$SERVER_NAME = $_SERVER['SERVER_NAME'];
4511+
$SERVER_PORT = $_SERVER['SERVER_PORT'];
4512+
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4513+
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off';
45134514
} else {
45144515
$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
45154516
}
@@ -5326,12 +5327,12 @@ function getTypeDef($type, $ns) {
53265327
* @access private
53275328
*/
53285329
function webDescription(){
5329-
global $HTTP_SERVER_VARS;
5330+
global $_SERVER;
53305331

53315332
if (isset($_SERVER)) {
53325333
$PHP_SELF = $_SERVER['PHP_SELF'];
5333-
} elseif (isset($HTTP_SERVER_VARS)) {
5334-
$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
5334+
} elseif (isset($_SERVER)) {
5335+
$PHP_SELF = $_SERVER['PHP_SELF'];
53355336
} else {
53365337
$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
53375338
}

0 commit comments

Comments
 (0)