Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed warnings reported by compatibility checker tools #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 12 additions & 80 deletions lib/class.soap_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,12 @@ function __construct($wsdl=false){
parent::__construct();
// turn on debugging?
global $debug;
global $HTTP_SERVER_VARS;

if (isset($_SERVER)) {
$this->debug("_SERVER is defined:");
$this->appendDebug($this->varDump($_SERVER));
} elseif (isset($HTTP_SERVER_VARS)) {
$this->debug("HTTP_SERVER_VARS is defined:");
$this->appendDebug($this->varDump($HTTP_SERVER_VARS));
} else {
$this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
$this->debug("_SERVER is not defined.");
}

if (isset($debug)) {
Expand All @@ -197,16 +193,7 @@ function __construct($wsdl=false){
$this->debug_flag = substr($v, 6);
}
}
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
foreach ($qs as $v) {
if (substr($v, 0, 6) == 'debug=') {
$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
$this->debug_flag = substr($v, 6);
}
}
}

// wsdl
if($wsdl){
$this->debug("In nusoap_server, WSDL is specified");
Expand Down Expand Up @@ -234,20 +221,14 @@ function __construct($wsdl=false){
* @access public
*/
function service($data){
global $HTTP_SERVER_VARS;

if (isset($_SERVER['REQUEST_METHOD'])) {
$rm = $_SERVER['REQUEST_METHOD'];
} elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
$rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
} else {
$rm = '';
}

if (isset($_SERVER['QUERY_STRING'])) {
$qs = $_SERVER['QUERY_STRING'];
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
} else {
$qs = '';
}
Expand Down Expand Up @@ -318,8 +299,6 @@ function service($data){
* @access private
*/
function parse_http_headers() {
global $HTTP_SERVER_VARS;

$this->request = '';
$this->SOAPAction = '';
if(function_exists('getallheaders')){
Expand Down Expand Up @@ -381,40 +360,6 @@ function parse_http_headers() {
$this->request .= "$k: $v\r\n";
$this->debug("$k: $v");
}
} elseif (is_array($HTTP_SERVER_VARS)) {
$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
foreach ($HTTP_SERVER_VARS as $k => $v) {
if (substr($k, 0, 5) == 'HTTP_') {
$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5));
} else {
$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k);
}
if ($k == 'soapaction') {
// get SOAPAction header
$k = 'SOAPAction';
$v = str_replace('"', '', $v);
$v = str_replace('\\', '', $v);
$this->SOAPAction = $v;
} else if ($k == 'content-type') {
// get the character encoding of the incoming request
if (strpos($v, '=')) {
$enc = substr(strstr($v, '='), 1);
$enc = str_replace('"', '', $enc);
$enc = str_replace('\\', '', $enc);
if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
}
} else {
// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
$this->xml_encoding = 'ISO-8859-1';
}
}
$this->headers[$k] = $v;
$this->request .= "$k: $v\r\n";
$this->debug("$k: $v");
}
} else {
$this->debug("In parse_http_headers, HTTP headers not accessible");
$this->setError("HTTP headers not accessible");
Expand Down Expand Up @@ -777,7 +722,7 @@ function send_response() {
//begin code to compress payload - by John
// NOTE: there is no way to know whether the Web server will also compress
// this data.
if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
if (strstr($this->headers['accept-encoding'], 'gzip')) {
if (function_exists('gzencode')) {
if (isset($this->debug_flag) && $this->debug_flag) {
Expand Down Expand Up @@ -904,7 +849,7 @@ function parseRequest($headers, $data) {
function getHTTPBody($soapmsg) {
return $soapmsg;
}

/**
* gets the HTTP content type for the current response.
*
Expand All @@ -916,7 +861,7 @@ function getHTTPBody($soapmsg) {
function getHTTPContentType() {
return 'text/xml';
}

/**
* gets the HTTP content type charset for the current response.
* returns false for non-text content types.
Expand Down Expand Up @@ -958,8 +903,6 @@ function add_to_map($methodname,$in,$out){
* @access public
*/
function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
global $HTTP_SERVER_VARS;

if($this->externalWSDLURL){
die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
}
Expand All @@ -978,13 +921,9 @@ function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=fa
if (isset($_SERVER)) {
$SERVER_NAME = $_SERVER['SERVER_NAME'];
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
} elseif (isset($HTTP_SERVER_VARS)) {
$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off';
} else {
$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
$this->setError("_SERVER is not available");
}
if ($HTTPS == '1' || $HTTPS == 'on') {
$SCHEME = 'https';
Expand Down Expand Up @@ -1047,20 +986,13 @@ function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
*/
function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
{
global $HTTP_SERVER_VARS;

if (isset($_SERVER)) {
$SERVER_NAME = $_SERVER['SERVER_NAME'];
$SERVER_PORT = $_SERVER['SERVER_PORT'];
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
} elseif (isset($HTTP_SERVER_VARS)) {
$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
$HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
$HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : 'off';
} else {
$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
$this->setError("_SERVER is not available");
}
// If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
$colon = strpos($SERVER_NAME,":");
Expand All @@ -1075,7 +1007,7 @@ function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style=
if(false == $namespace) {
$namespace = "http://$SERVER_NAME/soap/$serviceName";
}

if(false == $endpoint) {
if ($HTTPS == '1' || $HTTPS == 'on') {
$SCHEME = 'https';
Expand All @@ -1084,11 +1016,11 @@ function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style=
}
$endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
}

if(false == $schemaTargetNamespace) {
$schemaTargetNamespace = $namespace;
}

$this->wsdl = new wsdl;
$this->wsdl->serviceName = $serviceName;
$this->wsdl->endpoint = $endpoint;
Expand Down Expand Up @@ -1124,4 +1056,4 @@ class soap_server extends nusoap_server {
}


?>
?>
Loading