From 7fbd194478e080d624bab075d189bf3ba215325d Mon Sep 17 00:00:00 2001 From: gggeek Date: Mon, 27 May 2019 08:04:00 +0000 Subject: [PATCH] One more fix for issue #55 --- NEWS | 7 +++++++ src/Client.php | 4 ++++ src/Encoder.php | 7 ++++--- src/Helper/Charset.php | 2 ++ src/PhpXmlRpc.php | 2 +- src/Request.php | 3 +-- src/Value.php | 16 +++++++++++++++- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 6a788b5e..fa06c12b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +XML-RPC for PHP version 4.3.2 - 2019/5/27 + +* fixed: remove one php 7.2 warning when using the v3 compatibility layer + +* improved: the Travis tests are now run with all php versions from 5.6 to 7.3. We dropped tests with php 5.3, 5.4 and 5.5 + + XML-RPC for PHP version 4.3.1 - 2018/1/20 * fixed: error when using https in non-curl mode diff --git a/src/Client.php b/src/Client.php index 8c782c3b..074c1966 100644 --- a/src/Client.php +++ b/src/Client.php @@ -567,6 +567,8 @@ protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $userna $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http') { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return $this->sendPayloadSocket($req, $server, $port, $timeout, $username, $password, $authType, null, null, null, null, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, $method); } @@ -600,6 +602,8 @@ protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $usernam $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', $sslVersion = 0) { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return $this->sendPayloadCURL($req, $server, $port, $timeout, $username, $password, $authType, $cert, $certPass, $caCert, $caCertDir, $proxyHost, $proxyPort, $proxyUsername, $proxyPassword, $proxyAuthType, 'https', $keepAlive, $key, $keyPass, $sslVersion); diff --git a/src/Encoder.php b/src/Encoder.php index b015115a..ebf3060d 100644 --- a/src/Encoder.php +++ b/src/Encoder.php @@ -214,8 +214,7 @@ public function encode($phpVal, $options = array()) // catch "user function", "unknown type" default: // giancarlo pinerolo - // it has to return - // an empty object in case, not a boolean. + // it has to return an empty object in case, not a boolean. $xmlrpcVal = new Value(); break; } @@ -227,6 +226,8 @@ public function encode($phpVal, $options = array()) * Convert the xml representation of a method response, method request or single * xmlrpc value into the appropriate object (a.k.a. deserialize). * + * Q: is this a good name for this method? It does something quite different from 'decode' after all (returning objects vs returns plain php values)... + * * @param string $xmlVal * @param array $options * @@ -291,7 +292,7 @@ public function decodeXml($xmlVal, $options = array()) } switch ($xmlRpcParser->_xh['rt']) { case 'methodresponse': - $v = &$xmlRpcParser->_xh['value']; + $v = $xmlRpcParser->_xh['value']; if ($xmlRpcParser->_xh['isf'] == 1) { /** @var Value $vc */ $vc = $v['faultCode']; diff --git a/src/Helper/Charset.php b/src/Helper/Charset.php index 4f1103bb..f00087c9 100644 --- a/src/Helper/Charset.php +++ b/src/Helper/Charset.php @@ -261,6 +261,8 @@ public function isValidCharset($encoding, $validList) */ public function getEntities($charset) { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + switch ($charset) { case 'iso88591': diff --git a/src/PhpXmlRpc.php b/src/PhpXmlRpc.php index e9fb6e95..8b64d079 100644 --- a/src/PhpXmlRpc.php +++ b/src/PhpXmlRpc.php @@ -79,7 +79,7 @@ class PhpXmlRpc public static $xmlrpc_internalencoding = "UTF-8"; public static $xmlrpcName = "XML-RPC for PHP"; - public static $xmlrpcVersion = "4.3.1"; + public static $xmlrpcVersion = "4.3.2"; // let user errors start at 800 public static $xmlrpcerruser = 800; diff --git a/src/Request.php b/src/Request.php index 9bd9029b..b3b8112a 100644 --- a/src/Request.php +++ b/src/Request.php @@ -334,8 +334,7 @@ public function parseResponse($data = '', $headersProcessed = false, $returnType ); } - // note that using =& will raise an error if $xmlRpcParser->_xh['st'] does not generate an object. - $v = &$xmlRpcParser->_xh['value']; + $v = $xmlRpcParser->_xh['value']; if ($xmlRpcParser->_xh['isf']) { /// @todo we should test here if server sent an int and a string, and/or coerce them into such... diff --git a/src/Value.php b/src/Value.php index ae73aaa8..f51579b3 100644 --- a/src/Value.php +++ b/src/Value.php @@ -350,6 +350,8 @@ public function serialize($charsetEncoding = '') */ public function structmemexists($key) { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return array_key_exists($key, $this->me['struct']); } @@ -365,6 +367,8 @@ public function structmemexists($key) */ public function structmem($key) { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return $this->me['struct'][$key]; } @@ -374,6 +378,8 @@ public function structmem($key) */ public function structreset() { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + reset($this->me['struct']); } @@ -386,7 +392,9 @@ public function structreset() */ public function structeach() { - return each($this->me['struct']); + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + + return @each($this->me['struct']); } /** @@ -430,6 +438,8 @@ public function scalartyp() */ public function arraymem($key) { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return $this->me['array'][$key]; } @@ -442,6 +452,8 @@ public function arraymem($key) */ public function arraysize() { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return count($this->me['array']); } @@ -454,6 +466,8 @@ public function arraysize() */ public function structsize() { + //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); + return count($this->me['struct']); }