From: ggiunta Date: Thu, 16 Jul 2009 22:33:31 +0000 (+0000) Subject: - xmlrpc.inc: add support for the from the apache library, both in input... X-Git-Tag: 3.0.0-beta~23 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=2df63e76b84037b28b9a534d9df06c75537caefb - xmlrpc.inc: add support for the from the apache library, both in input and output - xmlrpc.inc, testsuite.php: remove usage of split(), deprecated in php 5.3 - testsuite.php: flush better results with output_buffering on - server: php: avoid one warning about static function calls git-svn-id: https://svn.code.sf.net/p/phpxmlrpc/code/trunk/xmlrpc@23 013ecfd8-0664-425d-a759-9c98391dc3f9 --- diff --git a/ChangeLog b/ChangeLog index da7d5f5..b7227b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-16 - G. Giunta (giunta.gaetano@gmail.com) thanks Jean-Jacques Sarton + + * xmlrpc.inc: add support for the from the apache library, both + in input and output + + * xmlrpc.inc, testsuite.php: remove usage of split(), deprecated in php 5.3 + + * testsuite.php: flush better results with output_buffering on + + * server: php: avoid one warning about static function calls + 2009-07-02 - G. Giunta (giunta.gaetano@gmail.com) thanks Heiko Stuebner * xmlrpc.inc: fix: when checking the parameters against the signatures xmlrpc @@ -12,7 +23,7 @@ * create php4 branch, rename trunk to 3.0.0beta - it will be the php5-only version - * xmlrpc.inc: removed test fpr php version and inclusion of compat patches for really + * xmlrpc.inc: removed test for php version and inclusion of compat patches for really really old versions of php 4 2009-03-16 - G. Giunta (giunta.gaetano@gmail.com) thanks Tommaso Trani diff --git a/demo/server/server.php b/demo/server/server.php index 2a8d185..3a42ad3 100644 --- a/demo/server/server.php +++ b/demo/server/server.php @@ -36,14 +36,14 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) return new xmlrpcresp(new xmlrpcval(1, 'boolean')); } - /** - * a PHP version of the state-number server. Send me an integer and i'll sell you a state - * @param integer $s - * @return string - * */ - function findstate($s) - { - return inner_findstate($s); + /** + * a PHP version of the state-number server. Send me an integer and i'll sell you a state + * @param integer $s + * @return string + * */ + static function findstate($s) + { + return inner_findstate($s); } } @@ -129,7 +129,7 @@ in an alphabetic order.'; $findstate3_sig = wrap_php_function(array('xmlrpc_server_methods_container', 'findstate')); - $obj = new xmlrpc_server_methods_container(); + $obj = new xmlrpc_server_methods_container(); $findstate4_sig = wrap_php_function(array($obj, 'findstate')); @@ -241,7 +241,7 @@ in an alphabetic order.'; $agesorter_doc='Send this method an array of [string, int] structs, eg:
  Dave   35
- Edd    45
+ Edd	45
  Fred   23
  Barney 37
 
@@ -570,9 +570,9 @@ mimetype, a string, is a standard MIME type, for example, text/plain. return new xmlrpcresp(new xmlrpcval(array( "ctLeftAngleBrackets" => new xmlrpcval($lt, "int"), "ctRightAngleBrackets" => new xmlrpcval($gt, "int"), - "ctAmpersands" => new xmlrpcval($amp, "int"), - "ctApostrophes" => new xmlrpcval($ap, "int"), - "ctQuotes" => new xmlrpcval($qu, "int")), + "ctAmpersands" => new xmlrpcval($amp, "int"), + "ctApostrophes" => new xmlrpcval($ap, "int"), + "ctQuotes" => new xmlrpcval($qu, "int")), "struct" )); } diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index b02eae2..a4c9ef2 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -89,7 +89,8 @@ 'METHODNAME' => array('METHODCALL'), 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), 'FAULT' => array('METHODRESPONSE'), - 'NIL' => array('VALUE') // only used when extension activated + 'NIL' => array('VALUE'), // only used when extension activated + 'EX:NIL' => array('VALUE') // only used when extension activated ); // define extra types for supporting NULL (useful for json or ) @@ -220,9 +221,12 @@ /// @deprecated $GLOBALS['xmlrpc_backslash']=chr(92).chr(92); - // set to TRUE to enable correct decoding of values + // set to TRUE to enable correct decoding of and values $GLOBALS['xmlrpc_null_extension']=false; + // set to TRUE to enable encoding of php NULL values to instead of + $GLOBALS['xmlrpc_null_apache_encoding']=false; + // used to store state during parsing // quick explanation of components: // ac - used to accumulate values @@ -495,6 +499,7 @@ $GLOBALS['_xh']['vt']=null; break; case 'NIL': + case 'EX:NIL': if ($GLOBALS['xmlrpc_null_extension']) { if ($GLOBALS['_xh']['vt']!='value') @@ -720,6 +725,7 @@ $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']); break; case 'NIL': + case 'EX:NIL': if ($GLOBALS['xmlrpc_null_extension']) { $GLOBALS['_xh']['vt']='null'; @@ -2289,7 +2295,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha } } // be tolerant to line endings, and extra empty lines - $ar = split("\r?\n", trim(substr($data, 0, $pos))); + $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); while(list(,$line) = @each($ar)) { // take care of multi-line headers and cookies @@ -2922,7 +2928,14 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha $rs.="<${typ}>".preg_replace('/\\.?0+$/','',number_format((double)$val, 128, '.', '')).""; break; case $GLOBALS['xmlrpcNull']: - $rs.=""; + if ($GLOBALS['xmlrpc_null_apache_encoding']) + { + $rs.=""; + } + else + { + $rs.=""; + } break; default: // no standard type value should arrive here, but provide a possibility @@ -3399,7 +3412,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha { $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']); } - if (in_array('null_extension', $options)) + else if (in_array('null_extension', $options)) { $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']); } diff --git a/test/PHPUnit/TestSuite.php b/test/PHPUnit/TestSuite.php index f0618d0..629b3fc 100644 --- a/test/PHPUnit/TestSuite.php +++ b/test/PHPUnit/TestSuite.php @@ -157,7 +157,7 @@ class PHPUnit_TestSuite { for ($i = 0; $i < sizeof($this->_tests) && !$result->shouldStop(); $i++) { $this->_tests[$i]->run($result); if ($show_progress != '') { - echo $show_progress; flush(); + echo $show_progress; flush(); ob_flush(); } } } diff --git a/test/testsuite.php b/test/testsuite.php index 93de1bd..5784be4 100644 --- a/test/testsuite.php +++ b/test/testsuite.php @@ -14,6 +14,7 @@ if ((int)ini_get('max_execution_time') < 180) ini_set('max_execution_time', 180); + ini_set('max_execution_time', 180); $suite = new PHPUnit_TestSuite(); @@ -51,7 +52,7 @@ function setUp() { global $DEBUG, $LOCALSERVER, $URI; - $server = split(':', $LOCALSERVER); + $server = explode(':', $LOCALSERVER); if(count($server) > 1) { $this->client=new xmlrpc_client($URI, $server[0], $server[1]); @@ -1307,7 +1308,7 @@ $f = 'assertEquals(8, $r->faultCode()); // now test a successful connection - $server = split(':', $LOCALSERVER); + $server = explode(':', $LOCALSERVER); if(count($server) > 1) { $this->client->port = $server[1]; @@ -1409,6 +1410,7 @@ $f = 'Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."\n"; echo '

Running '.$suite->testCount().' tests (some of which are multiple) against servers: http://'.htmlspecialchars($LOCALSERVER.$URI).' and https://'.htmlspecialchars($HTTPSSERVER.$HTTPSURI)."\n ...

\n"; flush(); + ob_flush(); } else { @@ -1470,4 +1472,4 @@ Proxy Server: \n\n"; } -?> +?> \ No newline at end of file