Skip to content

Commit

Permalink
Fix: The issue causing a Deprecated error in PHP 8.2 has been fixed. …
Browse files Browse the repository at this point in the history
…The variable $substrXml is no longer used, as it was erroneously receiving null for the offset and is now irrelevant.
  • Loading branch information
d.nebolsin authored and f3l1x committed Jul 19, 2023
1 parent 227c935 commit 9ead68e
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ function getmicrotime()
$sec = time();
$usec = 0;
}
$dtx = new DateTime("@$sec");
$dtx = new DateTime("@$sec");
return
date_format($dtx, 'Y-m-d H:i:s') . '.' . sprintf('%06d', $usec);
}
Expand Down Expand Up @@ -1098,7 +1098,7 @@ function serialize()
foreach ($this->namespaces as $k => $v) {
$ns_string .= "\n xmlns:$k=\"$v\"";
}

return '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?>' .
'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string . ">\n" .
'<SOAP-ENV:Body>' .
Expand Down Expand Up @@ -1767,7 +1767,7 @@ function serializeSchema()
foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
$el .= " xmlns:$nsp=\"$ns\"";
}

return $el . ">\n" . $xml . "</$schemaPrefix:schema>\n";
}

Expand Down Expand Up @@ -2139,7 +2139,7 @@ class soapval extends nusoap_base
* @access private
*/
var $attributes;

/** @var false|resource */
var $fp;

Expand Down Expand Up @@ -2238,7 +2238,7 @@ class soap_transport_http extends nusoap_base
// certpassword: SSL certificate password
// verifypeer: default is 1
// verifyhost: default is 1

/** @var false|resource */
var $fp;
var $errno;
Expand Down Expand Up @@ -2620,7 +2620,7 @@ function connect($connection_timeout = 0, $response_timeout = 30)
function send($data, $timeout = 0, $response_timeout = 30, $cookies = null)
{
$this->debug('entered send() with data of length: ' . strlen($data));

$respdata = "";
$this->tryagain = true;
$tries = 0;
Expand Down Expand Up @@ -2710,7 +2710,7 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
// ) <">
// if qop is missing,
// request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">

$nonce = $digestRequest['nonce'];
$cnonce = $nonce;
if ($digestRequest['qop'] != '') {
Expand Down Expand Up @@ -3462,7 +3462,7 @@ function parseCookie($cookie_str)
if ($sep_pos) {
$name = substr($value_str, 0, $sep_pos);
$value = substr($value_str, $sep_pos + 1);

return array('name' => $name,
'value' => $value,
'domain' => $domain,
Expand Down Expand Up @@ -3721,7 +3721,7 @@ class nusoap_server extends nusoap_base
* @access public
*/
var $debug_flag = false;

/** @var array */
var $opData;

Expand Down Expand Up @@ -4461,7 +4461,7 @@ function parseRequest($headers, $data)
$this->methodURI = $parser->root_struct_namespace;
$this->methodname = $parser->root_struct_name;
$this->debug('methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);

// get/set custom response tag name
$outputMessage = $this->wsdl->getOperationData($this->methodname)['output']['message'];
$this->responseTagName = $outputMessage;
Expand Down Expand Up @@ -4778,7 +4778,7 @@ class wsdl extends nusoap_base
var $password = ''; // Password for HTTP authentication
var $authtype = ''; // Type of HTTP authentication
var $certRequest = array(); // Certificate for HTTP SSL authentication

/** @var mixed */
var $currentPortOperation;
/** @var string */
Expand Down Expand Up @@ -6840,9 +6840,9 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
$substrXml = $xml;
foreach($this->attachments as $key => $attachment) {
$startPos = max(
stripos($substrXml, $attachment['boundaryStr']),
(array_key_exists('Content-Type', $attachment) ? stripos($substrXml, $attachment['Content-Type']) : 0),
(array_key_exists('Content-Id', $attachment) ? stripos($substrXml, $attachment['Content-Id']) : 0),
stripos($substrXml, $attachment['boundaryStr']),
(array_key_exists('Content-Type', $attachment) ? stripos($substrXml, $attachment['Content-Type']) : 0),
(array_key_exists('Content-Id', $attachment) ? stripos($substrXml, $attachment['Content-Id']) : 0),
(array_key_exists('Content-Transfer-Encoding', $attachment) ? stripos($substrXml, $attachment['Content-Transfer-Encoding']) : 0)
);
$substrXml = substr($substrXml, $startPos);
Expand All @@ -6855,8 +6855,6 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
}
$content = substr($substrXml, 0, $length);
$this->attachments[$key]['content'] = $content;

$substrXml = substr($substrXml, $length);
}
}

Expand All @@ -6870,7 +6868,7 @@ function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = tru
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');

if(!empty($attachment['content'])) {
$content = $attachment['content'];
foreach(preg_split("/((\r?\n)|(\r\n?))/", $content) as $line){
Expand Down Expand Up @@ -7427,7 +7425,7 @@ function buildVal($pos)
$ret = $this->message[$pos]['cdata'];
$this->debug("in buildVal, return: $ret");
}

return $ret;
}
}
Expand Down Expand Up @@ -7523,7 +7521,7 @@ class nusoap_client extends nusoap_base
* @access public
*/
var $faultdetail;

/** @var wsdl|null */
var $wsdl;
/** @var mixed */
Expand Down Expand Up @@ -8257,7 +8255,7 @@ function _getProxyClassCode($r)
if ($this->endpointType != 'wsdl') {
$evalStr = 'A proxy can only be created for a WSDL client';
$this->setError($evalStr);

return "echo \"$evalStr\";";
}
if (is_null($this->wsdl)) {
Expand Down Expand Up @@ -8296,7 +8294,7 @@ function " . str_replace('.', '__', $operation) . "($paramStr) {
unset($paramCommentStr);
}
}

return 'class nusoap_proxy_' . $r . ' extends nusoap_client {
' . $evalStr . '
}';
Expand Down

0 comments on commit 9ead68e

Please sign in to comment.