cvs: pear /XML_RPC RPC.php package.xml package2.xml /XML_RPC/tests allgot.inc empty-value-struct.php empty-value.php types.php

From: Date: Sat, 15 Oct 2005 20:29:47 +0000
Subject: cvs: pear /XML_RPC RPC.php package.xml package2.xml /XML_RPC/tests allgot.inc empty-value-struct.php empty-value.php types.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35582@lists.php.net to get a copy of this message
danielc Sat Oct 15 16:29:47 2005 EDT Added files: /pear/XML_RPC/tests allgot.inc empty-value-struct.php empty-value.php types.php Modified files: /pear/XML_RPC RPC.php package.xml package2.xml Log: * Properly deal with empty values in struct's. * Add some test files.

http://cvs.php.net/diff.php/pear/XML_RPC/RPC.php?r1=1.87&r2=1.88&ty=u Index: pear/XML_RPC/RPC.php diff -u pear/XML_RPC/RPC.php:1.87 pear/XML_RPC/RPC.php:1.88 --- pear/XML_RPC/RPC.php:1.87 Sun Sep 18 16:55:19 2005 +++ pear/XML_RPC/RPC.php Sat Oct 15 16:29:43 2005 @@ -32,7 +32,7 @@ * @author Martin Jansen <mj@php.net> * @author Daniel Convissor <danielc@php.net> * @copyright 1999-2001 Edd Dumbill, 2001-2005 The PHP Group - * @version CVS: $Id: RPC.php,v 1.87 2005/09/18 20:55:19 danielc Exp $ + * @version CVS: $Id: RPC.php,v 1.88 2005/10/15 20:29:43 danielc Exp $ * @link http://pear.php.net/package/XML_RPC */ @@ -446,13 +446,13 @@ break; case 'VALUE': - // deal with a string value - if (strlen($XML_RPC_xh[$parser]['ac']) > 0 && - $XML_RPC_xh[$parser]['vt'] == $XML_RPC_String) { - $XML_RPC_xh[$parser]['value'] = $XML_RPC_xh[$parser]['ac']; - } elseif ($XML_RPC_xh[$parser]['lv'] == 1) { - // The <value> element was empty. - $XML_RPC_xh[$parser]['value'] = ''; + if ($XML_RPC_xh[$parser]['vt'] == $XML_RPC_String) { + if (strlen($XML_RPC_xh[$parser]['ac']) > 0) { + $XML_RPC_xh[$parser]['value'] = $XML_RPC_xh[$parser]['ac']; + } elseif ($XML_RPC_xh[$parser]['lv'] == 1) { + // The <value> element was empty. + $XML_RPC_xh[$parser]['value'] = ''; + } } $temp = new XML_RPC_Value($XML_RPC_xh[$parser]['value'], $XML_RPC_xh[$parser]['vt']); http://cvs.php.net/diff.php/pear/XML_RPC/package.xml?r1=1.70&r2=1.71&ty=u Index: pear/XML_RPC/package.xml diff -u pear/XML_RPC/package.xml:1.70 pear/XML_RPC/package.xml:1.71 --- pear/XML_RPC/package.xml:1.70 Sat Sep 24 14:19:40 2005 +++ pear/XML_RPC/package.xml Sat Oct 15 16:29:44 2005 @@ -2,7 +2,7 @@ <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package version="1.0"> - <!-- $Id: package.xml,v 1.70 2005/09/24 18:19:40 danielc Exp $ --> + <!-- $Id: package.xml,v 1.71 2005/10/15 20:29:44 danielc Exp $ --> <name>XML_RPC</name> <summary>PHP implementation of the XML-RPC protocol</summary> @@ -30,11 +30,11 @@ <release> - <version>1.4.3</version> - <date>2005-09-24</date> + <version>1.4.4</version> + <date>2005-10-15</date> <state>stable</state> <notes><![CDATA[ -* Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. +* Properly deal with empty values in struct's. ]]></notes> <filelist> @@ -48,12 +48,23 @@ <replace from="@package_version@" to="version" type="package-info" /> </file> <dir name="tests" role="test"> + <file name="allgot.inc"> + </file> + <file name="empty-value-struct.php"> + <replace from="@package_version@" to="version" type="package-info"/> + </file> + <file name="empty-value.php"> + <replace from="@package_version@" to="version" type="package-info"/> + </file> <file name="protoport.php"> <replace from="@package_version@" to="version" type="package-info"/> </file> <file name="test_Dump.php"> <replace from="@package_version@" to="version" type="package-info"/> </file> + <file name="types.php"> + <replace from="@package_version@" to="version" type="package-info"/> + </file> </dir> </filelist> </release> @@ -61,6 +72,15 @@ <changelog> <release> + <version>1.4.3</version> + <date>2005-09-24</date> + <state>stable</state> + <notes><![CDATA[ +* Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. + ]]></notes> + </release> + + <release> <version>1.4.2</version> <date>2005-09-18</date> <state>stable</state> http://cvs.php.net/diff.php/pear/XML_RPC/package2.xml?r1=1.32&r2=1.33&ty=u Index: pear/XML_RPC/package2.xml diff -u pear/XML_RPC/package2.xml:1.32 pear/XML_RPC/package2.xml:1.33 --- pear/XML_RPC/package2.xml:1.32 Sat Sep 24 14:21:31 2005 +++ pear/XML_RPC/package2.xml Sat Oct 15 16:29:44 2005 @@ -8,7 +8,7 @@ http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> - <!-- $Id: package2.xml,v 1.32 2005/09/24 18:21:31 danielc Exp $ --> + <!-- $Id: package2.xml,v 1.33 2005/10/15 20:29:44 danielc Exp $ --> <name>XML_RPC</name> <channel>pear.php.net</channel> @@ -32,10 +32,10 @@ <active>yes</active> </lead> - <date>2005-09-24</date> + <date>2005-10-15</date> <version> - <release>1.4.3</release> + <release>1.4.4</release> <api>1.4.0</api> </version> <stability> @@ -45,34 +45,40 @@ <license uri="http://www.php.net/license/3_0.txt">PHP License</license> <notes><![CDATA[ -* Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. +* Properly deal with empty values in struct's. ]]></notes> <contents> <dir name="/"> <dir name="tests"> + <file name="allgot.inc" role="test"> + </file> + <file name="empty-value-struct.php" role="test"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file name="empty-value.php" role="test"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> <file name="protoport.php" role="test"> - <tasks:replace from="@package_version@" to="version" - type="package-info" /> + <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file name="test_Dump.php" role="test"> - <tasks:replace from="@package_version@" to="version" - type="package-info" /> + <tasks:replace from="@package_version@" to="version" type="package-info" /> + </file> + <file name="types.php" role="test"> + <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> </dir> <file baseinstalldir="XML/RPC" name="Dump.php" role="php"> - <tasks:replace from="@package_version@" to="version" - type="package-info" /> + <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file baseinstalldir="XML" name="RPC.php" role="php"> - <tasks:replace from="@package_version@" to="version" - type="package-info" /> + <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> <file baseinstalldir="XML/RPC" name="Server.php" role="php"> - <tasks:replace from="@package_version@" to="version" - type="package-info" /> + <tasks:replace from="@package_version@" to="version" type="package-info" /> </file> </dir> @@ -102,6 +108,22 @@ <release> <version> + <release>1.4.3</release> + <api>1.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2005-09-24</date> + <license uri="http://www.php.net/license/3_0.txt">PHP License</license> + <notes><![CDATA[ +* Make XML_RPC_encode() properly handle dateTime.iso8601. Request 5117. + ]]></notes> + </release> + + <release> + <version> <release>1.4.2</release> <api>1.4.0</api> </version> http://cvs.php.net/co.php/pear/XML_RPC/tests/allgot.inc?r=1.1&p=1 Index: pear/XML_RPC/tests/allgot.inc +++ pear/XML_RPC/tests/allgot.inc <?php /** * * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Web Services * @package XML_RPC * @author Daniel Convissor <danielc@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version CVS: $Id: allgot.inc,v 1.1 2005/10/15 20:29:46 danielc Exp $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.4.4 */ ob_start(); function returnAllGot($params) { $out = ''; $count = count($params->params); for ($i = 0; $i < $count; $i++) { $param = $params->getParam($i); if (!XML_RPC_Value::isValue($param)) { $out .= "parameter $i was error: $param\n"; continue; } $got = XML_RPC_Decode($param); $out .= "param $i: " . var_export($got, true) . "\n"; } $val = new XML_RPC_Value($out, 'string'); return new XML_RPC_Response($val); } $server = new XML_RPC_Server( array( 'allgot' => array( 'function' => 'returnAllGot', ), ) ); $got = ob_get_clean(); if ($got == $expect) { echo "passed\n"; } else { echo "FAILED\n"; echo "Expected:\n$expect\n"; echo "Got:\n$got\n"; } http://cvs.php.net/co.php/pear/XML_RPC/tests/empty-value-struct.php?r=1.1&p=1 Index: pear/XML_RPC/tests/empty-value-struct.php +++ pear/XML_RPC/tests/empty-value-struct.php <?php /** * Tests how the XML_RPC server handles a parameter with an empty struct without * any spaces in the XML after the empty value. * * If you are running this test from a CVS checkout, you must rename the working * directory from "XML_RPC" to "XML". * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Web Services * @package XML_RPC * @author Daniel Convissor <danielc@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version CVS: $Id: empty-value-struct.php,v 1.1 2005/10/15 20:29:46 danielc Exp $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.4.4 */ /* * If the package version number is found in the left hand * portion of the if() expression below, that means this file has * come from the PEAR installer. Therefore, let's test the * installed version of XML_RPC which should be in the include path. * * If the version has not been substituted in the if() expression, * this file has likely come from a CVS checkout or a .tar file. * Therefore, we'll assume the tests should use the version of * XML_RPC that has come from there as well. */ if ('@package_version@' != '@'.'package_version'.'@') { /** * Get the needed class from the PEAR installation */ require_once 'XML/RPC/Server.php'; } else { if (substr(dirname(__FILE__), -9, -6) != 'XML') { echo "The parent directory must be named 'XML'.\n"; exit; } ini_set('include_path', '../../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); /** * Get the needed class from the parent directory */ require_once '../Server.php'; } $GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST <?xml version="1.0"?> <methodCall> <methodName>allgot</methodName> <params> <param> <value> <struct> <member> <name>fld1</name><value></value></member></struct></value> </param> </params> </methodCall> EOPOST; $expect = <<<EOEXP <?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param> <value><string>param 0: array ( 'fld1' =&gt; '', ) </string></value> </param> </params> </methodResponse> EOEXP; include './allgot.inc'; http://cvs.php.net/co.php/pear/XML_RPC/tests/empty-value.php?r=1.1&p=1 Index: pear/XML_RPC/tests/empty-value.php +++ pear/XML_RPC/tests/empty-value.php <?php /** * Tests how the XML_RPC server handles parameters with empty values. * * If you are running this test from a CVS checkout, you must rename the working * directory from "XML_RPC" to "XML". * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Web Services * @package XML_RPC * @author Daniel Convissor <danielc@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version CVS: $Id: empty-value.php,v 1.1 2005/10/15 20:29:46 danielc Exp $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.4.4 */ /* * If the package version number is found in the left hand * portion of the if() expression below, that means this file has * come from the PEAR installer. Therefore, let's test the * installed version of XML_RPC which should be in the include path. * * If the version has not been substituted in the if() expression, * this file has likely come from a CVS checkout or a .tar file. * Therefore, we'll assume the tests should use the version of * XML_RPC that has come from there as well. */ if ('@package_version@' != '@'.'package_version'.'@') { /** * Get the needed class from the PEAR installation */ require_once 'XML/RPC/Server.php'; } else { if (substr(dirname(__FILE__), -9, -6) != 'XML') { echo "The parent directory must be named 'XML'.\n"; exit; } ini_set('include_path', '../../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); /** * Get the needed class from the parent directory */ require_once '../Server.php'; } $GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST <?xml version="1.0"?> <methodCall> <methodName>allgot</methodName> <params> <param><value><string></string></value></param> <param><value>first</value></param> <param><value> </value></param> <param><value></value></param> </params> </methodCall> EOPOST; $expect = <<<EOEXP <?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param> <value><string>param 0: '' param 1: 'first' param 2: ' ' param 3: '' </string></value> </param> </params> </methodResponse> EOEXP; include './allgot.inc'; http://cvs.php.net/co.php/pear/XML_RPC/tests/types.php?r=1.1&p=1 Index: pear/XML_RPC/tests/types.php +++ pear/XML_RPC/tests/types.php <?php /** * Tests how the XML_RPC server handles a bunch of different parameter * data types. * * If you are running this test from a CVS checkout, you must rename the working * directory from "XML_RPC" to "XML". * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category Web Services * @package XML_RPC * @author Daniel Convissor <danielc@php.net> * @copyright 2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version CVS: $Id: types.php,v 1.1 2005/10/15 20:29:46 danielc Exp $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.4.4 */ /* * If the package version number is found in the left hand * portion of the if() expression below, that means this file has * come from the PEAR installer. Therefore, let's test the * installed version of XML_RPC which should be in the include path. * * If the version has not been substituted in the if() expression, * this file has likely come from a CVS checkout or a .tar file. * Therefore, we'll assume the tests should use the version of * XML_RPC that has come from there as well. */ if ('@package_version@' != '@'.'package_version'.'@') { /** * Get the needed class from the PEAR installation */ require_once 'XML/RPC/Server.php'; } else { if (substr(dirname(__FILE__), -9, -6) != 'XML') { echo "The parent directory must be named 'XML'.\n"; exit; } ini_set('include_path', '../../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); /** * Get the needed class from the parent directory */ require_once '../Server.php'; } $GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOPOST <?xml version="1.0"?> <methodCall> <methodName>allgot</methodName> <params> <param><value>default to string</value></param> <param><value><string>inside string</string></value></param> <param><value><int>8</int></value></param> <param><value><datetime.iso8601>20050809T01:33:44</datetime.iso8601></value></param> <param> <value> <array> <data> <value> <string>a</string> </value> <value> <string>b</string> </value> </data> </array> </value> </param> <param> <value> <struct> <member> <name>a</name> <value> <string>ay</string> </value> </member> <member> <name>b</name> <value> <string>be</string> </value> </member> </struct> </value> </param> </params> </methodCall> EOPOST; $expect = <<<EOEXP <?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param> <value><string>param 0: 'default to string' param 1: 'inside string' param 2: '8' param 3: '20050809T01:33:44' param 4: array ( 0 =&gt; 'a', 1 =&gt; 'b', ) param 5: array ( 'a' =&gt; 'ay', 'b' =&gt; 'be', ) </string></value> </param> </params> </methodResponse> EOEXP; include './allgot.inc';
« previous php.pear.cvs (#35582) next »