From fce41d1c5ca142dccfe3a9b51edcc13acdc4a7ba Mon Sep 17 00:00:00 2001 From: ggiunta Date: Thu, 7 May 2009 15:30:49 +0000 Subject: [PATCH] - replace all usage of '= & new' with '= new', as this is deprecated in php 5 and has been shown to cause problems too git-svn-id: https://svn.code.sf.net/p/phpxmlrpc/code/trunk/xmlrpc@16 013ecfd8-0664-425d-a759-9c98391dc3f9 --- ChangeLog | 7 ++- debugger/action.php | 12 +++--- lib/xmlrpc.inc | 94 ++++++++++++++++++++--------------------- lib/xmlrpc_wrappers.inc | 18 ++++---- lib/xmlrpcs.inc | 48 ++++++++++----------- test/benchmark.php | 32 +++++++------- test/testsuite.php | 8 ++-- 7 files changed, 112 insertions(+), 107 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f8ca49..a30eddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2009-04-06 - G. Giunta (giunta.gaetano@gmail.com) +2009-05-07 - G. Giunta (giunta.gaetano@gmail.com) + + * replace all usage of '= & new' with '= new', as this is deprecated in php 5 + and has been shown to cause problems too + +2009-05-06 - G. Giunta (giunta.gaetano@gmail.com) * create php4 branch, rename trunk to 3.0.0beta - it will be the php5-only version diff --git a/debugger/action.php b/debugger/action.php index f1df960..081340b 100644 --- a/debugger/action.php +++ b/debugger/action.php @@ -66,10 +66,10 @@ td form {margin: 0;} if ($port != "") { - $client =& new $clientclass($path, $host, $port); + $client = new $clientclass($path, $host, $port); $server = "$host:$port$path"; } else { - $client =& new $clientclass($path, $host); + $client = new $clientclass($path, $host); $server = "$host$path"; } if ($protocol == 2) @@ -158,20 +158,20 @@ td form {margin: 0;} // fall thru intentionally case 'describe': case 'wrap': - $msg[0] =& new $msgclass('system.methodHelp', null, $id); + $msg[0] = new $msgclass('system.methodHelp', null, $id); $msg[0]->addparam(new xmlrpcval($method)); - $msg[1] =& new $msgclass('system.methodSignature', null, $id+1); + $msg[1] = new $msgclass('system.methodSignature', null, $id+1); $msg[1]->addparam(new xmlrpcval($method)); $actionname = 'Description of method "'.$method.'"'; break; case 'list': - $msg[0] =& new $msgclass('system.listMethods', null, $id); + $msg[0] = new $msgclass('system.listMethods', null, $id); $actionname = 'List of available methods'; break; case 'execute': if (!payload_is_safe($payload)) die("Tsk tsk tsk, please stop it or I will have to call in the cops!"); - $msg[0] =& new $msgclass($method, null, $id); + $msg[0] = new $msgclass($method, null, $id); // hack! build xml payload by hand if ($wstype == 1) { diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index f57051a..b02eae2 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -557,7 +557,7 @@ if ($rebuild_xmlrpcvals) { // build the xmlrpc val out of the data received, and substitute it - $temp =& new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']); + $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']); // in case we got info about underlying php class, save it // in the object we're rebuilding if (isset($GLOBALS['_xh']['php_class'])) @@ -1115,7 +1115,7 @@ } elseif(is_string($msg)) { - $n =& new xmlrpcmsg(''); + $n = new xmlrpcmsg(''); $n->payload = $msg; $msg = $n; } @@ -1345,7 +1345,7 @@ else { $this->errstr='Connect error: '.$this->errstr; - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')'); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')'); return $r; } @@ -1353,7 +1353,7 @@ { fclose($fp); $this->errstr='Write error'; - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr); return $r; } else @@ -1404,7 +1404,7 @@ if(!function_exists('curl_init')) { $this->errstr='CURL unavailable on this install'; - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']); return $r; } if($method == 'https') @@ -1413,7 +1413,7 @@ ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version'])))) { $this->errstr='SSL unavailable on this install'; - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']); return $r; } } @@ -1634,7 +1634,7 @@ if(!$result) /// @todo we should use a better check here - what if we get back '' or '0'? { $this->errstr='no response'; - $resp=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl)); + $resp=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl)); curl_close($curl); if($keepalive) { @@ -1705,7 +1705,7 @@ } else { - $result =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']); + $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']); } } } @@ -1752,17 +1752,17 @@ $calls = array(); foreach($msgs as $msg) { - $call['methodName'] =& new xmlrpcval($msg->method(),'string'); + $call['methodName'] = new xmlrpcval($msg->method(),'string'); $numParams = $msg->getNumParams(); $params = array(); for($i = 0; $i < $numParams; $i++) { $params[$i] = $msg->getParam($i); } - $call['params'] =& new xmlrpcval($params, 'array'); - $calls[] =& new xmlrpcval($call, 'struct'); + $call['params'] = new xmlrpcval($params, 'array'); + $calls[] = new xmlrpcval($call, 'struct'); } - $multicall =& new xmlrpcmsg('system.multicall'); + $multicall = new xmlrpcmsg('system.multicall'); $multicall->addParam(new xmlrpcval($calls, 'array')); // Attempt RPC call @@ -1810,7 +1810,7 @@ return false; // Bad value } // Normal return value - $response[$i] =& new xmlrpcresp($val[0], 0, '', 'phpvals'); + $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals'); break; case 2: /// @todo remove usage of @: it is apparently quite slow @@ -1824,7 +1824,7 @@ { return false; } - $response[$i] =& new xmlrpcresp(0, $code, $str); + $response[$i] = new xmlrpcresp(0, $code, $str); break; default: return false; @@ -1857,7 +1857,7 @@ return false; // Bad value } // Normal return value - $response[$i] =& new xmlrpcresp($val->arraymem(0)); + $response[$i] = new xmlrpcresp($val->arraymem(0)); break; case 'struct': $code = $val->structmem('faultCode'); @@ -1870,7 +1870,7 @@ { return false; } - $response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval()); + $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval()); break; default: return false; @@ -2239,7 +2239,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha else { error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTPS via proxy error, tunnel connection possibly failed'); - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)'); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)'); return $r; } } @@ -2260,7 +2260,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha { $errstr= substr($data, 0, strpos($data, "\n")-1); error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr); - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')'); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')'); return $r; } @@ -2385,7 +2385,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha if(!$data = decode_chunked($data)) { error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server'); - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']); return $r; } } @@ -2415,14 +2415,14 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha else { error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server'); - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']); return $r; } } else { error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']); return $r; } } @@ -2454,7 +2454,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha if($data == '') { error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.'); - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']); return $r; } @@ -2514,7 +2514,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha // if user wants back raw xml, give it to him if ($return_type == 'xml') { - $r =& new xmlrpcresp($data, 0, '', 'xml'); + $r = new xmlrpcresp($data, 0, '', 'xml'); $r->hdrs = $GLOBALS['_xh']['headers']; $r->_cookies = $GLOBALS['_xh']['cookies']; $r->raw_data = $raw_data; @@ -2586,7 +2586,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha xml_get_current_line_number($parser), xml_get_current_column_number($parser)); } error_log($errstr); - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')'); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')'); xml_parser_free($parser); if($this->debug) { @@ -2606,7 +2606,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha /// @todo echo something for user? } - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']); } // third error check: parsing of the response has somehow gone boink. @@ -2616,7 +2616,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha // something odd has happened // and it's time to generate a client side error // indicating something odd went on - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return']); } else @@ -2656,11 +2656,11 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha $errno = -1; } - $r =& new xmlrpcresp(0, $errno, $errstr); + $r = new xmlrpcresp(0, $errno, $errstr); } else { - $r=&new xmlrpcresp($v, 0, '', $return_type); + $r=new xmlrpcresp($v, 0, '', $return_type); } } @@ -2776,10 +2776,10 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha case 2: // we're adding a scalar value to an array here //$ar=$this->me['array']; - //$ar[]=&new xmlrpcval($val, $type); + //$ar[]=new xmlrpcval($val, $type); //$this->me['array']=$ar; // Faster (?) avoid all the costly array-copy-by-val done here... - $this->me['array'][]=&new xmlrpcval($val, $type); + $this->me['array'][]=new xmlrpcval($val, $type); return 1; default: // a scalar, so set the value and remember we're scalar @@ -3330,20 +3330,20 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha { case 'string': if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val)) - $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']); + $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']); else - $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcString']); + $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']); break; case 'integer': - $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']); + $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']); break; case 'double': - $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']); + $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']); break; // // Add support for encoding/decoding of booleans, since they are supported in PHP case 'boolean': - $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']); + $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']); break; // case 'array': @@ -3366,11 +3366,11 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha } if($ko) { - $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); + $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); } else { - $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcArray']); + $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']); } break; case 'object': @@ -3385,7 +3385,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha { $arr[$k] = php_xmlrpc_encode($v, $options); } - $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); + $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); if (in_array('encode_php_objs', $options)) { // let's save original class name into xmlrpcval: @@ -3397,32 +3397,32 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha case 'NULL': if (in_array('extension_api', $options)) { - $xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcString']); + $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']); } if (in_array('null_extension', $options)) { - $xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcNull']); + $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']); } else { - $xmlrpc_val =& new xmlrpcval(); + $xmlrpc_val = new xmlrpcval(); } break; case 'resource': if (in_array('extension_api', $options)) { - $xmlrpc_val =& new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']); + $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']); } else { - $xmlrpc_val =& new xmlrpcval(); + $xmlrpc_val = new xmlrpcval(); } // catch "user function", "unknown type" default: // giancarlo pinerolo // it has to return // an empty object in case, not a boolean. - $xmlrpc_val =& new xmlrpcval(); + $xmlrpc_val = new xmlrpcval(); break; } return $xmlrpc_val; @@ -3486,15 +3486,15 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha { $vc = $v->structmem('faultCode'); $vs = $v->structmem('faultString'); - $r =& new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval()); + $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval()); } else { - $r =& new xmlrpcresp($v); + $r = new xmlrpcresp($v); } return $r; case 'methodcall': - $m =& new xmlrpcmsg($GLOBALS['_xh']['method']); + $m = new xmlrpcmsg($GLOBALS['_xh']['method']); for($i=0; $i < count($GLOBALS['_xh']['params']); $i++) { $m->addParam($GLOBALS['_xh']['params'][$i]); diff --git a/lib/xmlrpc_wrappers.inc b/lib/xmlrpc_wrappers.inc index 8b5bac9..9ca5750 100644 --- a/lib/xmlrpc_wrappers.inc +++ b/lib/xmlrpc_wrappers.inc @@ -214,7 +214,7 @@ // start to introspect PHP code if(is_array($funcname)) { - $func =& new ReflectionMethod($funcname[0], $funcname[1]); + $func = new ReflectionMethod($funcname[0], $funcname[1]); if($func->isPrivate()) { error_log('XML-RPC: method to be wrapped is private: '.$plainfuncname); @@ -244,7 +244,7 @@ } else { - $func =& new ReflectionFunction($funcname); + $func = new ReflectionFunction($funcname); } if($func->isInternal()) { @@ -504,7 +504,7 @@ if ($methodfilter == '' || preg_match($methodfilter, $mname)) { // echo $mlist."\n"; - $func =& new ReflectionMethod($classname, $mname); + $func = new ReflectionMethod($classname, $mname); if(!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) { if(($func->isStatic && ($methodtype == 'all' || $methodtype == 'static' || ($methodtype == 'auto' && is_string($classname)))) || @@ -600,7 +600,7 @@ $valclass = $prefix.'val'; $decodefunc = 'php_'.$prefix.'_decode'; - $msg =& new $msgclass('system.methodSignature'); + $msg = new $msgclass('system.methodSignature'); $msg->addparam(new $valclass($methodname)); $client->setDebug($debug); $response =& $client->send($msg, $timeout, $protocol); @@ -646,7 +646,7 @@ // in online mode, favour speed of operation if(!$buildit) { - $msg =& new $msgclass('system.methodHelp'); + $msg = new $msgclass('system.methodHelp'); $msg->addparam(new $valclass($methodname)); $response =& $client->send($msg, $timeout, $protocol); if (!$response->faultCode()) @@ -715,7 +715,7 @@ //$valclass = $prefix.'val'; $decodefunc = 'php_'.$prefix.'_decode'; - $msg =& new $msgclass('system.listMethods'); + $msg = new $msgclass('system.listMethods'); $response =& $client->send($msg, $timeout, $protocol); if($response->faultCode()) { @@ -835,7 +835,7 @@ $innercode = ''; $this_ = 'this->'; } - $innercode .= "\$msg =& new {$prefix}msg('$methodname');\n"; + $innercode .= "\$msg = new {$prefix}msg('$methodname');\n"; if ($mdesc != '') { @@ -858,7 +858,7 @@ $ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null') { // only build directly xmlrpcvals when type is known and scalar - $innercode .= "\$p$i =& new {$prefix}val(\$p$i, '$ptype');\n"; + $innercode .= "\$p$i = new {$prefix}val(\$p$i, '$ptype');\n"; } else { @@ -920,7 +920,7 @@ */ function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') { - $code = "\$client =& new {$prefix}_client('".str_replace("'", "\'", $client->path). + $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; // copy all client fields to the client that will be generated runtime diff --git a/lib/xmlrpcs.inc b/lib/xmlrpcs.inc index 9fc4d0c..8111e1c 100644 --- a/lib/xmlrpcs.inc +++ b/lib/xmlrpcs.inc @@ -85,13 +85,13 @@ $outAr=array(); foreach($server->dmap as $key => $val) { - $outAr[]=&new xmlrpcval($key, 'string'); + $outAr[]=new xmlrpcval($key, 'string'); } if($server->allow_system_funcs) { foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val) { - $outAr[]=&new xmlrpcval($key, 'string'); + $outAr[]=new xmlrpcval($key, 'string'); } } return new xmlrpcresp(new xmlrpcval($outAr, 'array')); @@ -130,22 +130,22 @@ $cursig=array(); foreach($inSig as $sig) { - $cursig[]=&new xmlrpcval($sig, 'string'); + $cursig[]=new xmlrpcval($sig, 'string'); } - $sigs[]=&new xmlrpcval($cursig, 'array'); + $sigs[]=new xmlrpcval($cursig, 'array'); } - $r=&new xmlrpcresp(new xmlrpcval($sigs, 'array')); + $r=new xmlrpcresp(new xmlrpcval($sigs, 'array')); } else { // NB: according to the official docs, we should be returning a // "none-array" here, which means not-an-array - $r=&new xmlrpcresp(new xmlrpcval('undef', 'string')); + $r=new xmlrpcresp(new xmlrpcval('undef', 'string')); } } else { - $r=&new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); + $r=new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); } return $r; } @@ -177,16 +177,16 @@ { if(isset($dmap[$methName]['docstring'])) { - $r=&new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string'); + $r=new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string'); } else { - $r=&new xmlrpcresp(new xmlrpcval('', 'string')); + $r=new xmlrpcresp(new xmlrpcval('', 'string')); } } else { - $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); } return $r; } @@ -207,8 +207,8 @@ $str = $err->faultString(); } $struct = array(); - $struct['faultCode'] =& new xmlrpcval($code, 'int'); - $struct['faultString'] =& new xmlrpcval($str, 'string'); + $struct['faultCode'] = new xmlrpcval($code, 'int'); + $struct['faultString'] = new xmlrpcval($str, 'string'); return new xmlrpcval($struct, 'struct'); } @@ -243,7 +243,7 @@ } $numParams = $params->arraysize(); - $msg =& new xmlrpcmsg($methName->scalarval()); + $msg = new xmlrpcmsg($methName->scalarval()); for($i = 0; $i < $numParams; $i++) { if(!$msg->addParam($params->arraymem($i))) @@ -819,14 +819,14 @@ } else { - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']); return $r; } } else { //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); - $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']); + $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']); return $r; } } @@ -957,7 +957,7 @@ if(!xml_parse($parser, $data, 1)) { // return XML error as a faultCode - $r=&new xmlrpcresp(0, + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser), sprintf('XML error: %s at line %d, column %d', xml_error_string(xml_get_error_code($parser)), @@ -967,7 +967,7 @@ elseif ($GLOBALS['_xh']['isf']) { xml_parser_free($parser); - $r=&new xmlrpcresp(0, + $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_request'], $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']); } @@ -985,7 +985,7 @@ else { // build an xmlrpcmsg object with data parsed from xml - $m=&new xmlrpcmsg($GLOBALS['_xh']['method']); + $m=new xmlrpcmsg($GLOBALS['_xh']['method']); // now add parameters in for($i=0; $idebug > 2) @@ -1191,7 +1191,7 @@ */ function echoInput() { - $r=&new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string')); + $r=new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string')); print $r->serialize(); } } diff --git a/test/benchmark.php b/test/benchmark.php index 0450b6c..7b58544 100644 --- a/test/benchmark.php +++ b/test/benchmark.php @@ -58,21 +58,21 @@ foreach ($data[$j] as $key => $val) { $values = array(); - $values[] =& new xmlrpcval($val[0], 'int'); - $values[] =& new xmlrpcval($val[1], 'double'); - $values[] =& new xmlrpcval($val[2], 'string'); - $values[] =& new xmlrpcval($val[3], 'boolean'); - $values[] =& new xmlrpcval($val[4], 'dateTime.iso8601'); - $values[] =& new xmlrpcval($val[5], 'i4'); - $values[] =& new xmlrpcval($val[6], 'double'); - $values[] =& new xmlrpcval($val[7], 'string'); - $values[] =& new xmlrpcval($val[8], 'boolean'); - $values[] =& new xmlrpcval($val[9], 'dateTime.iso8601'); - $valarray[$key] =& new xmlrpcval($values, 'array'); + $values[] = new xmlrpcval($val[0], 'int'); + $values[] = new xmlrpcval($val[1], 'double'); + $values[] = new xmlrpcval($val[2], 'string'); + $values[] = new xmlrpcval($val[3], 'boolean'); + $values[] = new xmlrpcval($val[4], 'dateTime.iso8601'); + $values[] = new xmlrpcval($val[5], 'i4'); + $values[] = new xmlrpcval($val[6], 'double'); + $values[] = new xmlrpcval($val[7], 'string'); + $values[] = new xmlrpcval($val[8], 'boolean'); + $values[] = new xmlrpcval($val[9], 'dateTime.iso8601'); + $valarray[$key] = new xmlrpcval($values, 'array'); } - $vals[] =& new xmlrpcval($valarray, 'struct'); + $vals[] = new xmlrpcval($valarray, 'struct'); } - $value =& new xmlrpcval($vals, 'array'); + $value = new xmlrpcval($vals, 'array'); $out = $value->serialize(); } end_test('Data encoding (large array)', 'manual encoding', $out); @@ -153,18 +153,18 @@ /// test multicall vs. many calls vs. keep-alives $value = php_xmlrpc_encode($data1); - $msg =& new xmlrpcmsg('interopEchoTests.echoValue', array($value)); + $msg = new xmlrpcmsg('interopEchoTests.echoValue', array($value)); $msgs=array(); for ($i = 0; $i < 25; $i++) $msgs[] = $msg; $server = split(':', $LOCALSERVER); if(count($server) > 1) { - $c =& new xmlrpc_client($URI, $server[0], $server[1]); + $c = new xmlrpc_client($URI, $server[0], $server[1]); } else { - $c =& new xmlrpc_client($URI, $LOCALSERVER); + $c = new xmlrpc_client($URI, $LOCALSERVER); } // do not interfere with http compression $c->accepted_compression = array(); diff --git a/test/testsuite.php b/test/testsuite.php index 08b7d91..93de1bd 100644 --- a/test/testsuite.php +++ b/test/testsuite.php @@ -54,11 +54,11 @@ $server = split(':', $LOCALSERVER); if(count($server) > 1) { - $this->client=&new xmlrpc_client($URI, $server[0], $server[1]); + $this->client=new xmlrpc_client($URI, $server[0], $server[1]); } else { - $this->client=&new xmlrpc_client($URI, $LOCALSERVER); + $this->client=new xmlrpc_client($URI, $LOCALSERVER); } if($DEBUG) { @@ -1164,11 +1164,11 @@ and there they were.postid7414222serialize()); $this->assertEquals($v1, $v2); - $r1 =& new xmlrpcresp($v1); + $r1 = new xmlrpcresp($v1); $r2 = php_xmlrpc_decode_xml($r1->serialize()); $r2->serialize(); // needed to set internal member payload $this->assertEquals($r1, $r2); - $m1 =& new xmlrpcmsg('hello dolly', array($v1)); + $m1 = new xmlrpcmsg('hello dolly', array($v1)); $m2 = php_xmlrpc_decode_xml($m1->serialize()); $m2->serialize(); // needed to set internal member payload $this->assertEquals($m1, $m2); -- 2.43.0