From dd3de5570489cd2bdf44afaa7efac759d19c6e9c Mon Sep 17 00:00:00 2001 From: gggeek Date: Mon, 3 Feb 2014 23:36:57 +0100 Subject: [PATCH] Bump requirements to 5.1.0; grammar fixes in comments --- ChangeLog | 6 ++++++ INSTALL | 2 +- composer.json | 5 ++++- lib/xmlrpc.inc | 27 +++++++++++++++------------ lib/xmlrpc_wrappers.inc | 25 ++----------------------- lib/xmlrpcs.inc | 17 +++++++++-------- test/verify_compat.php | 13 ++++--------- 7 files changed, 41 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48a7305..2c6dda7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,15 @@ +2014-02-3 - G. Giunta (giunta.gaetano@gmail.com) + + * bumped up requirements to php 5.1.0 + 2014-01-10 - G. Giunta (giunta.gaetano@gmail.com) * xmlrpc.inc: when using curl and keepalive, reset curl handle if we did not get back an http 200 response (eg a 302) * testsuite.php, parse_args.php: update testsuite + * debugger/controller.php: change default path to javascript debugger + 2010-05-23 - G. Giunta (giunta.gaetano@gmail.com) * xmlrpc.inc: omit port on http 'Host' header if it is 80; diff --git a/INSTALL b/INSTALL index 87ac013..2a39bdf 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Requirements ------------ The following requirements should be met prior to using 'XMLRPC for PHP': -. PHP 5.0 or later; 5.0.3 or later recommended to have all functionality enabled +. PHP 5.1.0 or later . the php "curl" extension is needed if you wish to use SSL or HTTP 1.1 to communicate with remote servers diff --git a/composer.json b/composer.json index 819d668..7252e17 100644 --- a/composer.json +++ b/composer.json @@ -2,8 +2,11 @@ "name": "phpxmlrpc/phpxmlrpc", "description": "A php library for building xmlrpc clients and servers", "license": "BSD-3-Clause", - "homepage": "http://phpxmlrpc.sourceforge.net/", + "homepage": "http://gggeek.github.io/phpxmlrpc/", "keywords": [ "xmlrpc", "webservices" ], + "require": { + "php": ">=5.1.0" + } "autoload": { "classmap": [ "lib/xmlrpc.inc", "lib/xmlrpcs.inc" ] } diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index c3c8995..aeaf4be 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -944,7 +944,7 @@ /** * Enables/disables the echoing to screen of the xmlrpc responses received - * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response) + * @param integer $in values 0, 1 and 2 are supported (2 = echo sent msg too, before received response) * @access public */ function setDebug($in) @@ -980,7 +980,7 @@ /** * Add a CA certificate to verify server with (see man page about - * CURLOPT_CAINFO for more details + * CURLOPT_CAINFO for more details) * @param string $cacert certificate file name (or dir holding certificates) * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false * @access public @@ -1112,7 +1112,7 @@ /** * Directly set cURL options, for extra flexibility * It allows eg. to bind client to a specific IP interface / address - * @param $options array + * @param array $options */ function SetCurlOptions( $options ) { @@ -1399,11 +1399,11 @@ } else { - // reset errno and errstr on succesful socket connection + // reset errno and errstr on successful socket connection $this->errstr = ''; } // G. Giunta 2005/10/24: close socket before parsing. - // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects) + // should yield slightly better execution times, and make easier recursive calls (e.g. to follow http redirects) $ipd=''; do { @@ -1541,7 +1541,6 @@ // return the header too curl_setopt($curl, CURLOPT_HEADER, 1); - // will only work with PHP >= 5.0 // NB: if we set an empty string, CURL will add http header indicating // ALL methods it is supporting. This is possibly a better option than // letting the user tell what curl can / cannot do... @@ -1729,7 +1728,7 @@ * @param array $msgs an array of xmlrpcmsg objects * @param integer $timeout connection timeout (in seconds) * @param string $method the http protocol variant to be used - * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted + * @param boolean fallback When true, upon receiving an error during multicall, multiple single calls will be attempted * @return array * @access public */ @@ -2036,7 +2035,7 @@ * with attributes being e.g. 'expires', 'path', domain'. * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past) * are still present in the array. It is up to the user-defined code to decide - * how to use the received cookies, and wheter they have to be sent back with the next + * how to use the received cookies, and whether they have to be sent back with the next * request to the server (using xmlrpc_client::setCookie) or not * @return array array of cookies received from the server * @access public @@ -2115,7 +2114,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha /** * @param string $meth the name of the method to invoke - * @param array $pars array of parameters to be paased to the method (xmlrpcval objects) + * @param array $pars array of parameters to be passed to the method (xmlrpcval objects) */ function xmlrpcmsg($meth, $pars=0) { @@ -2199,6 +2198,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha /** * Returns xml representation of the message. XML prologue included + * @param string $charset_encoding * @return string the xml representation of the message, xml prologue included * @access public */ @@ -2252,6 +2252,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha * infinite loop in that case, because we cannot trust the caller * to give us a valid pointer to an open file... * @access public + * @param resource $fp stream pointer * @return xmlrpcresp * @todo add 2nd & 3rd param to be passed to ParseResponse() ??? */ @@ -3081,7 +3082,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha } /** - * Checks wheter a struct member with a given name is present. + * Checks whether a struct member with a given name is present. * Works only on xmlrpcvals of type struct. * @param string $m the name of the struct member to be looked up * @return boolean @@ -3680,9 +3681,10 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers, * which will be most probably using UTF-8 anyway... * - * @param string $httpheaders the http Content-type header + * @param string $httpheader the http Content-type header * @param string $xmlchunk xml content buffer * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled) + * @return string * * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!! */ @@ -3775,6 +3777,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha * if it is a valid subset of any encoding in the list * @param string $encoding charset to be tested * @param mixed $validlist comma separated list of valid charsets (or array of charsets) + * @return bool */ function is_valid_charset($encoding, $validlist) { @@ -3795,7 +3798,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha foreach ($validlist as $allowed) if (in_array($allowed, $charset_supersets[$encoding])) return true; - return false; + return false; } } diff --git a/lib/xmlrpc_wrappers.inc b/lib/xmlrpc_wrappers.inc index 4a92348..1fbf5ce 100644 --- a/lib/xmlrpc_wrappers.inc +++ b/lib/xmlrpc_wrappers.inc @@ -105,7 +105,6 @@ * carried out by the lib, while datetime vals are passed around as strings) * * Known limitations: - * - requires PHP 5.0.3 + * - only works for user-defined functions, not for PHP internal functions * (reflection does not support retrieving number/type of params for those) * - functions returning php objects will generate special xmlrpc responses: @@ -149,14 +148,7 @@ $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : ''; - if(version_compare(phpversion(), '5.0.3') == -1) - { - // up to php 5.0.3 some useful reflection methods were missing - error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3'); - return false; - } - - $exists = false; + $exists = false; if (is_string($funcname) && strpos($funcname, '::') !== false) { $funcname = explode('::', $funcname); @@ -177,11 +169,6 @@ $plainfuncname = get_class($funcname[0]) . '->' . $funcname[1]; } $exists = method_exists($funcname[0], $funcname[1]); - if (!$exists && version_compare(phpversion(), '5.1') < 0) - { - // workaround for php 5.0: static class methods are not seen by method_exists - $exists = is_callable( $funcname ); - } } else { @@ -239,8 +226,7 @@ error_log('XML-RPC: method to be wrapped is the constructor: '.$plainfuncname); return false; } - // php 503 always says isdestructor = true... - if( version_compare(phpversion(), '5.0.3') != 0 && $func->isDestructor()) + if($func->isDestructor()) { error_log('XML-RPC: method to be wrapped is the destructor: '.$plainfuncname); return false; @@ -500,13 +486,6 @@ $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; $methodtype = isset($extra_options['method_type']) ? $extra_options['method_type'] : 'auto'; - if(version_compare(phpversion(), '5.0.3') == -1) - { - // up to php 5.0.3 some useful reflection methods were missing - error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3'); - return false; - } - $result = array(); $mlist = get_class_methods($classname); foreach($mlist as $mname) diff --git a/lib/xmlrpcs.inc b/lib/xmlrpcs.inc index 3fe530f..180595c 100644 --- a/lib/xmlrpcs.inc +++ b/lib/xmlrpcs.inc @@ -420,7 +420,7 @@ /** * Add a string to the debug info that can be later seralized by the server * as part of the response message. - * Note that for best compatbility, the debug string should be encoded using + * Note that for best compatibility, the debug string should be encoded using * the $GLOBALS['xmlrpc_internalencoding'] character set. * @param string $m * @access public @@ -450,7 +450,7 @@ * @see php_xmlrpc_encode for a list of values */ var $phpvals_encoding_options = array( 'auto_dates' ); - /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3 + /// controls whether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3 var $debug = 1; /** * Controls behaviour of server when invoked user function throws an exception: @@ -494,8 +494,8 @@ var $user_data = null; /** - * @param array $dispmap the dispatch map withd efinition of exposed services - * @param boolean $servicenow set to false to prevent the server from runnung upon construction + * @param array $dispmap the dispatch map with definition of exposed services + * @param boolean $servicenow set to false to prevent the server from running upon construction */ function xmlrpc_server($dispMap=null, $serviceNow=true) { @@ -540,7 +540,7 @@ * with the standard processing of the php function exposed as method. In * particular, triggering an USER_ERROR level error will not halt script * execution anymore, but just end up logged in the xmlrpc response) - * Note that info added at elevel 2 and 3 will be base64 encoded + * Note that info added at level 2 and 3 will be base64 encoded * @access public */ function setDebug($in) @@ -711,6 +711,7 @@ * Verify type and number of parameters received against a list of known signatures * @param array $in array of either xmlrpcval objects or xmlrpc type definitions * @param array $sig array of known signatures to match against + * @return array * @access private */ function verifySignature($in, $sig) @@ -776,7 +777,7 @@ /** * Parse http headers received along with xmlrpc request. If needed, inflate request - * @return null on success or an xmlrpcresp + * @return mixed null on success or an xmlrpcresp * @access private */ function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression) @@ -939,7 +940,7 @@ } /// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue, // the encoding is not UTF8 and there are non-ascii chars in the text... - /// @todo use an ampty string for php 5 ??? + /// @todo use an empty string for php 5 ??? $parser = xml_parser_create($req_encoding); } else @@ -1201,7 +1202,7 @@ /** * add a string to the 'internal debug message' (separate from 'user debug message') - * @param string $strings + * @param string $string * @access private */ function debugmsg($string) diff --git a/test/verify_compat.php b/test/verify_compat.php index 1d36107..a9862c4 100644 --- a/test/verify_compat.php +++ b/test/verify_compat.php @@ -19,15 +19,10 @@ function phpxmlrpc_verify_compat($mode='client') $ver = phpversion(); $tests['php_version'] = array(); $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n"; - if (version_compare($ver, '5') < 0) + if (version_compare($ver, '5.1.0') < 0) { $tests['php_version']['status'] = 0; - $tests['php_version']['description'] .= 'This version of PHP is not compatible with this release of the PHP XMLRPC library. Please upgrade to php 5 or later'; - } - else if (version_compare($ver, '5.0.3') < 0) - { - $tests['php_version']['status'] = 1; - $tests['php_version']['description'] .= "This version of PHP is almost completely compatible with the PHP XMLRPC library.\nThe only unavailable function is automatic mapping of php functions to xmlrpc methods"; + $tests['php_version']['description'] .= 'This version of PHP is not compatible with this release of the PHP XMLRPC library. Please upgrade to php 5.1.0 or later'; } else { @@ -71,10 +66,10 @@ function phpxmlrpc_verify_compat($mode='client') $ver = phpversion(); $tests['php_version'] = array(); $tests['php_version']['description'] = 'PHP version found: '.$ver.".\n\n"; - if (version_compare($ver, '5') < 0) + if (version_compare($ver, '5.1.0') < 0) { $tests['php_version']['status'] = 0; - $tests['php_version']['description'] .= 'This version of PHP is not compatible with the PHP XMLRPC library. Please upgrade to 5.0 or later'; + $tests['php_version']['description'] .= 'This version of PHP is not compatible with the PHP XMLRPC library. Please upgrade to 5.1.0 or later'; } else { -- 2.43.0