PK~Zb)))tests/actual-request.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: actual-request.php 300957 2010-07-02 23:55:00Z danielc $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.5.3 */ /* * 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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC/Dump.php'; $debug = 0; $params = array( new XML_RPC_Value('php.net', 'string'), ); $msg = new XML_RPC_Message('domquery', $params); $client = new XML_RPC_Client('/api/xmlrpc', 'www.adamsnames.com'); $client->setDebug($debug); $resp = $client->send($msg); if (!$resp) { echo 'Communication error: ' . $client->errstr; exit(1); } if ($resp->faultCode()) { /* * Display problems that have been gracefully cought and * reported by the xmlrpc.php script */ echo 'Fault Code: ' . $resp->faultCode() . "\n"; echo 'Fault Reason: ' . $resp->faultString() . "\n"; exit(1); } $val = $resp->value(); XML_RPC_Dump($val); PK~ZBtests/allgot.incnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: allgot.inc 293223 2010-01-07 15:32:19Z danielc $ * @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"; } PK~Z|E  tests/empty-value-struct.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: empty-value-struct.php 300957 2010-07-02 23:55:00Z danielc $ * @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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC/Server.php'; $GLOBALS['HTTP_RAW_POST_DATA'] = << allgot fld1 EOPOST; $expect = << param 0: array ( 'fld1' => '', ) EOEXP; include './allgot.inc'; PK~Z$]tests/empty-value.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: empty-value.php 300957 2010-07-02 23:55:00Z danielc $ * @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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC/Server.php'; $GLOBALS['HTTP_RAW_POST_DATA'] = << allgot first EOPOST; $expect = << param 0: '' param 1: 'first' param 2: ' ' param 3: '' EOEXP; include './allgot.inc'; PK~ZJtests/encode.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: extra-lines.php 293218 2010-01-07 14:20:08Z danielc $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.5.3 */ /* * 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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC.php'; $input = array(10, 11, 12); $expect = << nada 10 11 12 EOT; $expect = trim(preg_replace("/\r\n/", "\n", $expect)); $msg = new XML_RPC_Message('nada', array(XML_RPC_encode($input))); $msg->createPayload(); $actual = trim(preg_replace("/\r\n/", "\n", $msg->payload)); if ($actual == $expect) { echo "passed\n"; } else { echo "PROBLEM\n"; echo $actual; } $msg = new XML_RPC_Message('nada', array( new XML_RPC_Value( array( new XML_RPC_Value(10, 'int'), new XML_RPC_Value(11, 'int'), new XML_RPC_Value(12, 'int'), ), 'array' ) ) ); $msg->createPayload(); $actual = trim(preg_replace("/\r\n/", "\n", $msg->payload)); if ($actual == $expect) { echo "passed\n"; } else { echo "PROBLEM\n"; echo $actual; } PK~Z. tests/extra-lines.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: extra-lines.php 300958 2010-07-02 23:58:51Z danielc $ * @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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC.php'; $input = "First lfs\n\nSecond crlfs\r\n\r\nThird crs\r\rFourth line"; $expect_removed = "\r\n\r\nnada\r\n\r\n\r\nFirst lfs\r\nSecond crlfs\r\nThird crs\r\nFourth line\r\n\r\n\r\n\r\n"; $expect_not_removed = "\r\n\r\nnada\r\n\r\n\r\nFirst lfs\r\n\r\nSecond crlfs\r\n\r\nThird crs\r\n\r\nFourth line\r\n\r\n\r\n\r\n"; $msg = new XML_RPC_Message('nada', array(XML_RPC_encode($input))); $msg->createPayload(); if ($msg->payload == $expect_removed) { echo "passed\n"; } else { echo "PROBLEM\n"; } $msg = new XML_RPC_Message('nada', array(XML_RPC_encode($input))); $msg->remove_extra_lines = false; $msg->createPayload(); if ($msg->payload == $expect_not_removed) { echo "passed\n"; } else { echo "PROBLEM\n"; } PK~Z3l**tests/protoport.phpnu[ * @copyright 2005-2010 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version SVN: $Id: protoport.php 300957 2010-07-02 23:55:00Z danielc $ * @link http://pear.php.net/package/XML_RPC * @since File available since Release 1.2 */ /* * 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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') { ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path') ); } require_once 'XML/RPC.php'; /** * Compare the test result to the expected result * * If the test fails, echo out the results. * * @param array $expect the array of object properties you expect * from the test * @param object $actual the object results from the test * @param string $test_name the name of the test * * @return void */ function compare($expect, $actual, $test_name) { $actual = get_object_vars($actual); if (count(array_diff($actual, $expect))) { echo "$test_name failed.\nExpect: "; print_r($expect); echo "Actual: "; print_r($actual); echo "\n"; } } if (php_sapi_name() != 'cli') { echo "
\n";
}


$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 80,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver');
compare($x, $c, 'defaults');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 80,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'http://theserver');
compare($x, $c, 'defaults with http');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 443,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'https://theserver');
compare($x, $c, 'defaults with https');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 443,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'ssl://theserver');
compare($x, $c, 'defaults with ssl');


$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 65,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver', 65);
compare($x, $c, 'port 65');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 65,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'http://theserver', 65);
compare($x, $c, 'port 65 with http');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 65,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'https://theserver', 65);
compare($x, $c, 'port 65 with https');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 65,
    'proxy' => '',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 65);
compare($x, $c, 'port 65 with ssl');


$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 80,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver', 0,
                        'theproxy');
compare($x, $c, 'defaults proxy');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 80,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'http://',
    'proxy_port' => 8080,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'http://theserver', 0,
                        'http://theproxy');
compare($x, $c, 'defaults with http proxy');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 443,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 443,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'https://theserver', 0,
                        'https://theproxy');
compare($x, $c, 'defaults with https proxy');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 443,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 443,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 0,
                        'ssl://theproxy');
compare($x, $c, 'defaults with ssl proxy');


$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 65,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'http://',
    'proxy_port' => 6565,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver', 65,
                        'theproxy', 6565);
compare($x, $c, 'port 65 proxy 6565');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 65,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'http://',
    'proxy_port' => 6565,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'http://theserver', 65,
                        'http://theproxy', 6565);
compare($x, $c, 'port 65 with http proxy 6565');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 65,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 6565,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'https://theserver', 65,
                        'https://theproxy', 6565);
compare($x, $c, 'port 65 with https proxy 6565');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 65,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 6565,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'ssl://theserver', 65,
                        'ssl://theproxy', 6565);
compare($x, $c, 'port 65 with ssl proxy 6565');


$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'ssl://',
    'port' => 443,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 443,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver', 443,
                        'theproxy', 443);
compare($x, $c, 'port 443 no protocol and proxy port 443 no protocol');

$x = array(
    'path' => 'thepath',
    'server' => 'theserver',
    'protocol' => 'http://',
    'port' => 80,
    'proxy' => 'theproxy',
    'proxy_protocol' => 'ssl://',
    'proxy_port' => 6565,
    'proxy_user' => '',
    'proxy_pass' => '',
    'errno' => 0,
    'errstring' => '',
    'debug' => 0,
    'username' => '',
    'password' => '',
);
$c = new XML_RPC_Client('thepath', 'theserver', 0,
                        'ssl://theproxy', 6565);
compare($x, $c, 'port 443 no protocol and proxy port 443 no protocol');

echo "\nIf no other output was produced, these tests passed.\n";
PK~ZXXtests/test_Dump.phpnu[
 * @copyright  2005-2010 The PHP Group
 * @license    http://www.php.net/license/3_01.txt  PHP License
 * @version    SVN: $Id: test_Dump.php 300962 2010-07-03 02:24:24Z danielc $
 * @link       http://pear.php.net/package/XML_RPC
 */

/*
 * 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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') {
    ini_set('include_path', '../'
            . PATH_SEPARATOR . '.' . PATH_SEPARATOR
            . ini_get('include_path')
    );
}
require_once 'XML/RPC/Dump.php';


$val = new XML_RPC_Value(array(
    'title'    =>new XML_RPC_Value('das ist der Titel', 'string'),
    'startDate'=>new XML_RPC_Value(mktime(0,0,0,13,11,2004), 'dateTime.iso8601'),
    'endDate'  =>new XML_RPC_Value(mktime(0,0,0,15,11,2004), 'dateTime.iso8601'),
    'arkey'    => new XML_RPC_Value( array(
        new XML_RPC_Value('simple string'),
        new XML_RPC_Value(12345, 'int')
        ), 'array')
    )
    ,'struct');

XML_RPC_Dump($val);

echo '==============' . "\r\n";
$val2 = new XML_RPC_Value(44353, 'int');
XML_RPC_Dump($val2);

echo '==============' . "\r\n";
$val3 = new XML_RPC_Value('this should be a string', 'string');
XML_RPC_Dump($val3);

echo '==============' . "\r\n";
$val4 = new XML_RPC_Value(true, 'boolean');
XML_RPC_Dump($val4);

echo '==============' . "\r\n";
echo 'Next we will test the error handling...' . "\r\n";
$val5 = new XML_RPC_Value(array(
    'foo' => 'bar'
    ), 'struct');
XML_RPC_Dump($val5);

echo '==============' . "\r\n";
echo 'DONE' . "\r\n";
PK~Z̢		tests/types.phpnu[
 * @copyright  2005-2010 The PHP Group
 * @license    http://www.php.net/license/3_01.txt  PHP License
 * @version    SVN: $Id: types.php 300957 2010-07-02 23:55:00Z danielc $
 * @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 SVN 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 ('1.5.5' == '@'.'package_version'.'@') {
    ini_set('include_path', '../'
            . PATH_SEPARATOR . '.' . PATH_SEPARATOR
            . ini_get('include_path')
    );
}
require_once 'XML/RPC/Server.php';


$GLOBALS['HTTP_RAW_POST_DATA'] = <<

 allgot
  
   default to string
   inside string
   8
   20050809T01:33:44

   
    
     
      
       
        a
       
       
        b
       
      
     
    
   

   
    
     
      
       a
       
        ay
       
      
      
       b
       
        be
       
      
     
    
   

  
 
EOPOST;

$expect = <<



param 0: 'default to string'
param 1: 'inside string'
param 2: '8'
param 3: '20050809T01:33:44'
param 4: array (
  0 => 'a',
  1 => 'b',
)
param 5: array (
  'a' => 'ay',
  'b' => 'be',
)




EOEXP;

include './allgot.inc';
PK~Zb)))tests/actual-request.phpnu[PK~ZBqtests/allgot.incnu[PK~Z|Etests/empty-value-struct.phpnu[PK~Z$]tests/empty-value.phpnu[PK~ZJFtests/encode.phpnu[PK~Z.
W$tests/extra-lines.phpnu[PK~Z3l**e-tests/protoport.phpnu[PK~ZXXWtests/test_Dump.phpnu[PK~Z̢		J`tests/types.phpnu[PK		j