diff -Nru php-xml-rpc2-1.1.2/debian/changelog php-xml-rpc2-1.1.3/debian/changelog --- php-xml-rpc2-1.1.2/debian/changelog 2016-04-01 21:38:44.000000000 +0000 +++ php-xml-rpc2-1.1.3/debian/changelog 2016-11-28 15:18:50.000000000 +0000 @@ -1,8 +1,10 @@ -php-xml-rpc2 (1.1.2-1build1) xenial; urgency=medium +php-xml-rpc2 (1.1.3-0.1) unstable; urgency=medium - * No-change rebuild against php 7 + * Non-maintainer upload. + * Imported Upstream version 1.1.3 + * Rebuild with PHP 7.0 pkg-php-tools (Closes: #821636) - -- Nish Aravamudan Fri, 01 Apr 2016 21:38:44 +0000 + -- Ondřej Surý Mon, 28 Nov 2016 16:18:50 +0100 php-xml-rpc2 (1.1.2-1) unstable; urgency=medium diff -Nru php-xml-rpc2-1.1.2/package.xml php-xml-rpc2-1.1.3/package.xml --- php-xml-rpc2-1.1.2/package.xml 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/package.xml 2016-06-21 19:29:56.000000000 +0000 @@ -1,5 +1,5 @@ - + XML_RPC2 pear.php.net XML-RPC client/server library @@ -23,30 +23,25 @@ jal@ambitonline.com yes - 2014-03-30 - + 2016-06-21 + - 1.1.2 - 1.1.0 + 1.1.3 + 1.0.5 stable stable - PHP License 3.01 + LGPL-2.1 QA release -Bug #19587 PHP backend fails when encoding type is set to UTF-8 instead of utf-8 -Doc Bug #19357 package.xml points to nonexistent URL|license PHP 3.02 -Bug #19036 remove error_reporting (for PEAR QA team) - -Bug #18925 Test fails with latest HTTP_Request2 +Fix issues when installed via composer - - + @@ -64,7 +59,6 @@ - @@ -162,19 +156,7 @@ - - - - - - - - - - - - - + @@ -186,17 +168,33 @@ + + + + + - - - + + + + + + + + + + + + + + @@ -223,32 +221,38 @@ - 1.1.0b2 + 1.1.3 1.0.5 - beta + stable stable - 2011-02-26 - PHP License 3.02 + 2016-06-21 + LGPL-2.1 -Fix missing files in packaged version +QA release +Fix issues when installed via composer - 1.1.0b3 - 1.0.5 + 1.1.2 + 1.1.0 - beta + stable stable - 2011-02-26 - PHP License 3.02 + 2014-03-30 + PHP License 3.01 -Better usage of HTTP_Request2, allowing the use of pre-configured instances now +QA release +Bug #19587 PHP backend fails when encoding type is set to UTF-8 instead of utf-8 +Doc Bug #19357 package.xml points to nonexistent URL|license PHP 3.02 +Bug #19036 remove error_reporting (for PEAR QA team) + +Bug #18925 Test fails with latest HTTP_Request2 @@ -271,22 +275,32 @@ - 1.1.2 - 1.1.0 + 1.1.0b3 + 1.0.5 - stable + beta stable - 2014-03-30 - PHP License 3.01 + 2011-02-26 + PHP License 3.02 -QA release -Bug #19587 PHP backend fails when encoding type is set to UTF-8 instead of utf-8 -Doc Bug #19357 package.xml points to nonexistent URL|license PHP 3.02 -Bug #19036 remove error_reporting (for PEAR QA team) - -Bug #18925 Test fails with latest HTTP_Request2 +Better usage of HTTP_Request2, allowing the use of pre-configured instances now + + + + + 1.1.0b2 + 1.0.5 + + + beta + stable + + 2011-02-26 + PHP License 3.02 + +Fix missing files in packaged version diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/docs/Makefile php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/docs/Makefile --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/docs/Makefile 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/docs/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -phpdoc: - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/docs/tutorials/XML_RPC2.lyx php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/docs/tutorials/XML_RPC2.lyx --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/docs/tutorials/XML_RPC2.lyx 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/docs/tutorials/XML_RPC2.lyx 1970-01-01 00:00:00.000000000 +0000 @@ -1,320 +0,0 @@ -#LyX 1.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 221 -\textclass docbook-section -\language english -\inputencoding auto -\fontscheme default -\graphics default -\paperfontsize default -\spacing single -\papersize Default -\paperpackage a4 -\use_geometry 0 -\use_amsmath 0 -\use_natbib 0 -\use_numerical_citations 0 -\paperorientation portrait -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\defskip medskip -\quotes_language english -\quotes_times 2 -\papercolumns 1 -\papersides 1 -\paperpagestyle default - -\layout Title -\added_space_top vfill \added_space_bottom vfill -XML_RPC2 Tutorial -\layout Abstract - -This tutorial introduces basic usage of XML_RPC2 as a client/server library - in XML_RPC operations. - XML_RPC2 is a pear package providing XML_RPC client and server services. - XML-RPC is a simple remote procedure call protocol built using HTTP as - transport and XML as encoding. -\layout Abstract - -As a client library, XML_RPC2 is capable of creating a proxy class which - exposes the methods exported by the server. - As a server library, XML_RPC2 is capable of exposing methods from a class - or object instance, seamlessly exporting local methods as remotely callable - procedures. - -\layout Subsection - -Client usage -\layout Subsubsection - -Basic Usage -\layout Standard - -The most simple way to use the XML_RPC client is by letting XML_RPC2 select - the backend for you, and just give the client factory method the data referring - to the server: -\layout Itemize - -The server URI. -\layout Itemize - -The HTTP proxy URI (null if no proxy). -\layout Itemize - -The method prefix -\layout Code - -require_once('XML/RPC2/Client.php'); -\layout Code - -$client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, ''); -\layout Standard - -The factory will produce a client proxy. - This class exports whichever methods the server exports. - These methods are called just like regular local methods: -\layout Code - -print($client->hello('World')); -\layout Standard - -for a server that exports the method hello. - If the server has methods prefixed by a classname (example.hello), there - are two solutions. - Either call the method using brackets enclosing the otherwise php-invalid - method name: -\layout Code - -print($client->{example.hello}('World')); -\layout Standard - -Or specify a method prefix when creating the client instance: -\layout Code - -$client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, 'example.'); -\layout Code - -print($client->hello('World')); -\layout Subsubsection - -Error handling -\layout Standard - -XML_RPC2 uses exceptions to signal errors. - The phpdoc reference contains a class hierarchy useful to get a grasp of - possible errors. - The most important characteristics of the XML_RPC2 exception tree are: -\layout Itemize - -All XML_RPC2 exceptions are children of XML_RPC2_Exception. - If you want to filter out exceptions from this package, catch XML_RPC2_Exceptio -n -\layout Itemize - -Network failure is signaled by an XML_RPC2_TransportException -\layout Itemize - -Regular XML-RPC fault responses are signaled by an XML_RPC2_FaultException -\layout Itemize - -All other types of XML_RPC2_Exception signal package misuse or bug-induced - misbehaviour -\layout Standard - -Standard usage: -\layout Code - -require_once('XMLrequire_once('XML/RPC2/Client.php'); -\layout Code - -try { -\layout Code - - $client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, - ''); -\layout Code - - print($client->hello('World')); -\layout Code - -} catch (XML_RPC2_TransportException transportException) { -\layout Code - - // Handle network-induced exception -\layout Code - -} catch (XML_RPC2_FaultException fault) { -\layout Code - - // Handle fault returned by remote server -\layout Code - -} catch (XML_RPC2_Exception xmlRpcException) { -\layout Code - - // Handle abnormal XML_RPC2 package exception -\layout Code - -} catch (Exception e) { -\layout Code - - // Handle someone else's fault exception -\layout Code - -} -\layout Standard - -It is good practice to at least expect XML_RPC2_TransportException as network - failure can't ever be ruled out. - -\layout Subsection - -Server usage -\layout Subsubsection - -Basic Usage -\layout Standard - -To export an XML-RPC server using XML_RPC2, the first step is writing the - methods to export. - XML_RPC2 can export class methods (static methods) for a class, or all - methods for an object instance. - For this example, we'll export a class' static methods: -\layout Code - -class EchoServer { -\layout Code - - /** -\layout Code - - * echoecho echoes the message received -\layout Code - - * -\layout Code - - * @param string Message -\layout Code - - * @return string The echo -\layout Code - - */ -\layout Code - -\layout Code - - public static function echoecho($string) -\layout Code - - { -\layout Code - - return $string; -\layout Code - - } -\layout Code - - -\layout Code - - /** -\layout Code - - * Dummy method which won't be exported -\layout Code - - * -\layout Code - - * @xmlrpc.hidden -\layout Code - - */ -\layout Code - - public static function dummy() -\layout Code - - { -\layout Code - - return false; -\layout Code - - } -\layout Code - -\layout Code - - /** -\layout Code - - * hello says hello -\layout Code - - * -\layout Code - - * @param string Name -\layout Code - - * @return string Hello 'name' -\layout Code - - */ -\layout Code - - public function hello($name) -\layout Code - - { -\layout Code - - return "Hello $name"; -\layout Code - - } -\layout Code - -\layout Code - -} -\layout Standard - -Note that the method is documented using phpDoc docblocks. - The docblock is used to deduce the signature and method documentation, - required by the XML-RPC spec. - Non-documented methods are not exported. - Methods tagged with the tag @xmlrpc.hidden are not exported either (the - dummy method above won't be exported). -\layout Standard - -After creating the class, we need to get an XML_RPC2 server to export its - methods remotely: -\layout Code - -require_once 'XML/RPC2/Server.php'; -\layout Code - -$server = XML_RPC2_Server::create('EchoServer'); -\layout Code - -$server->handleCall(); -\layout Standard - -The XML_RPC2_Server automatically exports all of the EchoServer class public - static methods (echoecho in this case). - You may also export all of an instance's public methods (static or otherwise): -\layout Code - -require_once 'XML/RPC2/Server.php'; -\layout Code - -$server = XML_RPC2_Server::create(new EchoServer()); -\layout Code - -$server->handleCall(); -\the_end diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/lib/run-tests php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/lib/run-tests --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/lib/run-tests 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/lib/run-tests 1970-01-01 00:00:00.000000000 +0000 @@ -1,917 +0,0 @@ - $value) { - putenv("$key=$value"); -} -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Ilia Alshanetsky | - | Preston L. Bannister | - | Marcus Boerger | - | Derick Rethans | - | Sander Roobol | - | (based on version by: Stig Bakken ) | - | (based on the PHP 3 test framework by Rasmus Lerdorf) | - +----------------------------------------------------------------------+ - */ - -/* - Require exact specification of PHP executable to test (no guessing!). - Die if any internal errors encountered in test script. - Regularized output for simpler post-processing of output. - Optionally output error lines indicating the failing test source and log - for direct jump with MSVC or Emacs. -*/ - -/* - * TODO: - * - do not test PEAR components if base class and/or component class cannot be instanciated - */ - - -/* Sanity check to ensure that pcre extension needed by this script is avaliable. - * In the event it is not, print a nice error message indicating that this script will - * not run without it. - */ - -if (!extension_loaded("pcre")) { - echo <<'; -save_text($info_file, $php_info); -global $ini_overwrites; -$ini_overwrites = array( - 'mbstring.script_encoding=pass', - 'output_handler=', - 'zlib.output_compression=Off', - 'open_basedir=', - 'safe_mode=0', - 'disable_functions=', - 'output_buffering=Off', - 'error_reporting=2047', - 'display_errors=1', - 'log_errors=0', - 'html_errors=0', - 'track_errors=1', - 'report_memleaks=1', - 'docref_root=/phpmanual/', - 'docref_ext=.html', - 'error_prepend_string=', - 'error_append_string=', - 'auto_prepend_file=', - 'auto_append_file=', - 'magic_quotes_runtime=0', - ); -global $info_params; -$info_params = array(); -settings2array($ini_overwrites,$info_params); -$save = $info_params; -settings2paramsnoquotes($info_params); -$curdir = getcwd(); -chdir(dirname($info_file)); -$info_filename = basename($info_file); -$php_info = `"$php" $info_params $info_filename`; -chdir($curdir); -@unlink($info_file); -//$info_params = $save; -//settings2params($info_params); -define('TESTED_PHP_VERSION', `"$php" -r 'echo PHP_VERSION;'`); - -// Write test context information. - -echo " -===================================================================== -CWD : $cwd -PHP : $php $php_info -Extra dirs : "; -foreach ($user_tests as $test_dir) { - echo "{$test_dir}\n "; -} -echo " -===================================================================== -"; - -// Determine the tests to be run. -global $test_files, $test_results; -$test_files = array(); -$test_results = array(); -$GLOBALS['__PHP_FAILED_TESTS__'] = array(); - -// If parameters given assume they represent selected tests to run. -if (isset($argc) && $argc > 1) { - for ($i=1; $i<$argc; $i++) { - $testfile = realpath($argv[$i]); - if (is_dir($testfile)) { - find_files($testfile); - } else if (preg_match("/\.phpt$/", $testfile)) { - $test_files[] = $testfile; - } - } - $test_files = array_unique($test_files); - - // Run selected tests. - if (count($test_files)) { - usort($test_files, "test_sort"); - echo "Running selected tests.\n"; - foreach($test_files AS $name) { - $test_results[$name] = run_test($php,$name); - } - if (getenv('REPORT_EXIT_STATUS') == 1 and @ereg('FAILED( |$)', implode(' ', $test_results))) { - exit(1); - } - exit(0); - } -} - -// Compile a list of all test files (*.phpt). -$test_files = array(); -$exts_to_test = get_loaded_extensions(); -$exts_tested = count($exts_to_test); -$exts_skipped = 0; -$ignored_by_ext = 0; -sort($exts_to_test); -$test_dirs = array('tests', 'pear', 'ext'); - -foreach ($test_dirs as $dir) { - find_files("{$cwd}/{$dir}", ($dir == 'ext')); -} - -foreach ($user_tests as $dir) { - find_files($dir, ($dir == 'ext')); -} - -function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE) -{ - print($dir . "\n"); - global $test_files, $exts_to_test, $ignored_by_ext, $exts_skipped, $exts_tested; - - $o = opendir($dir) or error("cannot open directory: $dir"); - while (($name = readdir($o)) !== FALSE) { - if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 'CVS'))) { - $skip_ext = ($is_ext_dir && !in_array($name, $exts_to_test)); - if ($skip_ext) { - $exts_skipped++; - } - find_files("{$dir}/{$name}", FALSE, $ignore || $skip_ext); - } - - // Cleanup any left-over tmp files from last run. - if (substr($name, -4) == '.tmp') { - @unlink("$dir/$name"); - continue; - } - - // Otherwise we're only interested in *.phpt files. - if (substr($name, -5) == '.phpt') { - if ($ignore) { - $ignored_by_ext++; - } else { - $testfile = realpath("{$dir}/{$name}"); - $test_files[] = $testfile; - } - } - } - closedir($o); -} - -function test_sort($a, $b) { - global $cwd; - - $ta = strpos($a, "{$cwd}/tests")===0 ? 1 + (strpos($a, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; - $tb = strpos($b, "{$cwd}/tests")===0 ? 1 + (strpos($b, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; - if ($ta == $tb) { - return strcmp($a, $b); - } else { - return $tb - $ta; - } -} - -$test_files = array_unique($test_files); -usort($test_files, "test_sort"); - -$start_time = time(); - -echo "TIME START " . date('Y-m-d H:i:s', $start_time) . " -===================================================================== -"; - -foreach ($test_files as $name) { - $test_results[$name] = run_test($php,$name); -} - -$end_time = time(); - -// Summarize results - -if (0 == count($test_results)) { - echo "No tests were run.\n"; - return; -} - -$n_total = count($test_results); -$n_total += $ignored_by_ext; - -$sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 'FAILED'=>0); -foreach ($test_results as $v) { - $sum_results[$v]++; -} -$sum_results['SKIPPED'] += $ignored_by_ext; -$percent_results = array(); -while (list($v,$n) = each($sum_results)) { - $percent_results[$v] = (100.0 * $n) / $n_total; -} - -echo " -===================================================================== -TIME END " . date('Y-m-d H:i:s', $end_time); - -$summary = " -===================================================================== -TEST RESULT SUMMARY ---------------------------------------------------------------------- -Exts skipped : " . sprintf("%4d",$exts_skipped) . " -Exts tested : " . sprintf("%4d",$exts_tested) . " ---------------------------------------------------------------------- -Number of tests : " . sprintf("%4d",$n_total) . " -Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . " -Tests warned : " . sprintf("%4d (%2.1f%%)",$sum_results['WARNED'],$percent_results['WARNED']) . " -Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . " -Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . " ---------------------------------------------------------------------- -Time taken : " . sprintf("%4d seconds", $end_time - $start_time) . " -===================================================================== -"; -echo $summary; - -$failed_test_summary = ''; -if (count($GLOBALS['__PHP_FAILED_TESTS__'])) { - $failed_test_summary .= " -===================================================================== -FAILED TEST SUMMARY ---------------------------------------------------------------------- -"; - foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $failed_test_data) { - $failed_test_summary .= $failed_test_data['test_name'] . $failed_test_data['info'] . "\n"; - } - $failed_test_summary .= "=====================================================================\n"; -} - -if ($failed_test_summary && !getenv('NO_PHPTEST_SUMMARY')) { - echo $failed_test_summary; -} - -define('PHP_QA_EMAIL', 'php-qa@lists.php.net'); -define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); - -/* We got failed Tests, offer the user to send and e-mail to QA team, unless NO_INTERACTION is set */ -if (!getenv('NO_INTERACTION')) { - $fp = fopen("php://stdin", "r+"); - echo "\nPlease allow this report to be sent to the PHP QA\nteam. This will give us a better understanding in how\n"; - echo "PHP's test cases are doing. Note that the report will include\ndetailed configuration data about your system\n"; - echo "so if you are worried about exposing sensitive data,\nsave this to a file first and remove any sensitive data\n"; - echo "and then send this file to php-qa@lists.php.net.\n"; - echo "(choose \"s\" to just save the results to a file)? [Yns]: "; - flush(); - $user_input = fgets($fp, 10); - $just_save_results = (strtolower($user_input[0]) == 's'); - - if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { - /* - * Collect information about the host system for our report - * Fetch phpinfo() output so that we can see the PHP enviroment - * Make an archive of all the failed tests - * Send an email - */ - - /* Ask the user to provide an email address, so that QA team can contact the user */ - if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { - echo "\nPlease enter your email address.\n(You address will be mangled so that it will not go out on any\nmailinglist in plain text): "; - flush(); - $fp = fopen("php://stdin", "r+"); - $user_email = trim(fgets($fp, 1024)); - $user_email = str_replace("@", " at ", str_replace(".", " dot ", $user_email)); - } - - $failed_tests_data = ''; - $sep = "\n" . str_repeat('=', 80) . "\n"; - - $failed_tests_data .= $failed_test_summary . "\n"; - $failed_tests_data .= $summary . "\n"; - - if ($sum_results['FAILED']) { - foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $test_info) { - $failed_tests_data .= $sep . $test_info['name'] . $test_info['info']; - $failed_tests_data .= $sep . file_get_contents(realpath($test_info['output'])); - $failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff'])); - $failed_tests_data .= $sep . "\n\n"; - } - $status = "failed"; - } else { - $status = "success"; - } - - $failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep; - $failed_tests_data .= "OS:\n" . PHP_OS . " - " . php_uname() . "\n\n"; - $ldd = $automake = $autoconf = $libtool = $compiler = 'N/A'; - - if (substr(PHP_OS, 0, 3) != "WIN") { - $automake = shell_exec('automake --version'); - $autoconf = shell_exec('autoconf --version'); - /* Always use the generated libtool - Mac OSX uses 'glibtool' */ - $libtool = shell_exec('./libtool --version'); - /* Try the most common flags for 'version' */ - $flags = array('-v', '-V', '--version'); - $cc_status=0; - foreach($flags AS $flag) { - system(getenv('CC')." $flag >/dev/null 2>&1", $cc_status); - if ($cc_status == 0) { - $compiler = shell_exec(getenv('CC')." $flag 2>&1"); - break; - } - } - $ldd = shell_exec("ldd $php"); - } - $failed_tests_data .= "Automake:\n$automake\n"; - $failed_tests_data .= "Autoconf:\n$autoconf\n"; - $failed_tests_data .= "Libtool:\n$libtool\n"; - $failed_tests_data .= "Compiler:\n$compiler\n"; - $failed_tests_data .= "Bison:\n". @shell_exec('bison --version'). "\n"; - $failed_tests_data .= "Libraries:\n$ldd\n"; - $failed_tests_data .= "\n"; - - if (isset($user_email)) { - $failed_tests_data .= "User's E-mail: ".$user_email."\n\n"; - } - - $failed_tests_data .= $sep . "PHPINFO" . $sep; - $failed_tests_data .= shell_exec($php.' -dhtml_errors=0 -i'); - - $compression = 0; - - if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) { - $output_file = 'php_test_results_' . date('Ymd') . ( $compression ? '.txt.gz' : '.txt' ); - $fp = fopen($output_file, "w"); - fwrite($fp, $failed_tests_data); - fclose($fp); - - if (!$just_save_results) { - echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n"; - } - - echo "Please send ".$output_file." to ".PHP_QA_EMAIL." manually, thank you.\n"; - } else { - fwrite($fp, "\nThank you for helping to make PHP better.\n"); - fclose($fp); - } - } -} - -if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) { - exit(1); -} - -// -// Send Email to QA Team -// - -function mail_qa_team($data, $compression, $status = FALSE) -{ - $url_bits = parse_url(QA_SUBMISSION_PAGE); - if (empty($url_bits['port'])) $url_bits['port'] = 80; - - $data = "php_test_data=" . urlencode(base64_encode(preg_replace("/[\\x00]/", "[0x0]", $data))); - $data_length = strlen($data); - - $fs = fsockopen($url_bits['host'], $url_bits['port'], $errno, $errstr, 10); - if (!$fs) { - return FALSE; - } - - $php_version = urlencode(TESTED_PHP_VERSION); - - echo "\nPosting to {$url_bits['host']} {$url_bits['path']}\n"; - fwrite($fs, "POST ".$url_bits['path']."?status=$status&version=$php_version HTTP/1.1\r\n"); - fwrite($fs, "Host: ".$url_bits['host']."\r\n"); - fwrite($fs, "User-Agent: QA Browser 0.1\r\n"); - fwrite($fs, "Content-Type: application/x-www-form-urlencoded\r\n"); - fwrite($fs, "Content-Length: ".$data_length."\r\n\r\n"); - fwrite($fs, $data); - fwrite($fs, "\r\n\r\n"); - fclose($fs); - - return 1; -} - - -// -// Write the given text to a temporary file, and return the filename. -// - -function save_text($filename,$text) -{ - $fp = @fopen($filename,'w') or error("Cannot open file '" . $filename . "' (save_text)"); - fwrite($fp,$text); - fclose($fp); - if (1 < DETAILED) echo " -FILE $filename {{{ -$text -}}} -"; -} - -// -// Write an error in a format recognizable to Emacs or MSVC. -// - -function error_report($testname,$logname,$tested) -{ - $testname = realpath($testname); - $logname = realpath($logname); - switch (strtoupper(getenv('TEST_PHP_ERROR_STYLE'))) { - case 'MSVC': - echo $testname . "(1) : $tested\n"; - echo $logname . "(1) : $tested\n"; - break; - case 'EMACS': - echo $testname . ":1: $tested\n"; - echo $logname . ":1: $tested\n"; - break; - } -} - -// -// Run an individual test case. -// - -function run_test($php,$file) -{ - global $log_format, $info_params, $ini_overwrites; - - if (DETAILED) echo " -================= -TEST $file -"; - - // Load the sections of the test file. - $section_text = array( - 'TEST' => '(unnamed test)', - 'SKIPIF' => '', - 'GET' => '', - 'ARGS' => '', - ); - - $fp = @fopen($file, "r") or error("Cannot open test file: $file"); - - $section = ''; - while (!feof($fp)) { - $line = fgets($fp); - - // Match the beginning of a section. - if (@ereg('^--([A-Z]+)--',$line,$r)) { - $section = $r[1]; - $section_text[$section] = ''; - continue; - } - - // Add to the section text. - $section_text[$section] .= $line; - } - fclose($fp); - - /* For GET/POST tests, check if cgi sapi is avaliable and if it is, use it. */ - if ((!empty($section_text['GET']) || !empty($section_text['POST']))) { - if (file_exists("./sapi/cgi/php")) { - $old_php = $php; - $php = realpath("./sapi/cgi/php") . ' -C '; - } - } - - $shortname = str_replace($GLOBALS['cwd'].'/', '', $file); - $tested = trim($section_text['TEST'])." [$shortname]"; - - $tmp = realpath(dirname($file)); - if (!is_dir($tmp)) { - $tmp = dirname($file); - } - $tmp_skipif = $tmp . uniqid('/phpt.'); - $tmp_file = @ereg_replace('\.phpt$','.php',$file); - $tmp_post = $tmp . uniqid('/phpt.'); - - @unlink($tmp_skipif); - @unlink($tmp_file); - @unlink($tmp_post); - - // unlink old test results - @unlink(@ereg_replace('\.phpt$','.diff',$file)); - @unlink(@ereg_replace('\.phpt$','.log',$file)); - @unlink(@ereg_replace('\.phpt$','.exp',$file)); - @unlink(@ereg_replace('\.phpt$','.out',$file)); - - // Reset environment from any previous test. - putenv("REDIRECT_STATUS="); - putenv("QUERY_STRING="); - putenv("PATH_TRANSLATED="); - putenv("SCRIPT_FILENAME="); - putenv("REQUEST_METHOD="); - putenv("CONTENT_TYPE="); - putenv("CONTENT_LENGTH="); - - // Check if test should be skipped. - $info = ''; - $warn = false; - if (array_key_exists('SKIPIF', $section_text)) { - if (trim($section_text['SKIPIF'])) { - save_text($tmp_skipif, $section_text['SKIPIF']); - - $curdir = getcwd(); - chdir(dirname($tmp_skipif)); - $t_s = basename($tmp_skipif); - $output = `"$php" $info_params -f $t_s`; - chdir($curdir); - @unlink($tmp_skipif); - if (@eregi("^skip", trim($output))) { - echo "SKIP $tested"; - $reason = (@eregi("^skip[[:space:]]*(.+)\$", trim($output))) ? @eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - echo " (reason: $reason)\n"; - } else { - echo "\n"; - } - if (isset($old_php)) { - $php = $old_php; - } - return 'SKIPPED'; - } - if (@eregi("^info", trim($output))) { - $reason = (@ereg("^info[[:space:]]*(.+)\$", trim($output))) ? @ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - $info = " (info: $reason)"; - } - } - if (@eregi("^warn", trim($output))) { - $reason = (@ereg("^warn[[:space:]]*(.+)\$", trim($output))) ? @ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - $warn = true; /* only if there is a reason */ - $info = " (warn: $reason)"; - } - } - } - } - - // Default ini settings - $ini_settings = array(); - // additional ini overwrites - //$ini_overwrites[] = 'setting=value'; - settings2array($ini_overwrites, $ini_settings); - - // Any special ini settings - // these may overwrite the test defaults... - if (array_key_exists('INI', $section_text)) { - settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings); - } - settings2paramsnoquotes($ini_settings); - - // We've satisfied the preconditions - run the test! - save_text($tmp_file,$section_text['FILE']); - if (array_key_exists('GET', $section_text)) { - $query_string = trim($section_text['GET']); - } else { - $query_string = ''; - } - - putenv("REDIRECT_STATUS=1"); - putenv("QUERY_STRING=$query_string"); - putenv("PATH_TRANSLATED=$tmp_file"); - putenv("SCRIPT_FILENAME=$tmp_file"); - - $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; - - if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { - - $post = trim($section_text['POST']); - save_text($tmp_post,$post); - $content_length = strlen($post); - - putenv("REQUEST_METHOD=POST"); - putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); - putenv("CONTENT_LENGTH=$content_length"); - - $cmd = "\"$php\"$ini_settings -f $tmp_file 2>&1 < \"$tmp_post\""; - - } else { - - putenv("REQUEST_METHOD=GET"); - putenv("CONTENT_TYPE="); - putenv("CONTENT_LENGTH="); - - $cmd = "\"$php\"$ini_settings -f $tmp_file$args 2>&1"; - } - - if (DETAILED) echo " -CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . " -CONTENT_TYPE = " . getenv("CONTENT_TYPE") . " -PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . " -QUERY_STRING = " . getenv("QUERY_STRING") . " -REDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . " -REQUEST_METHOD = " . getenv("REQUEST_METHOD") . " -SCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . " -COMMAND $cmd -"; - - $out = `$cmd`; - - @unlink($tmp_post); - - // Does the output match what is expected? - $output = trim($out); - $output = preg_replace('/\r\n/',"\n",$output); - - /* when using CGI, strip the headers from the output */ - if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) { - $output = substr($output, ($pos + 2)); - } - - if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { - if (isset($section_text['EXPECTF'])) { - $wanted = trim($section_text['EXPECTF']); - } else { - $wanted = trim($section_text['EXPECTREGEX']); - } - $wanted_re = preg_replace('/\r\n/',"\n",$wanted); - if (isset($section_text['EXPECTF'])) { - $wanted_re = preg_quote($wanted_re, '/'); - // Stick to basics - $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy - $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); - $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); - $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); - $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); - $wanted_re = str_replace("%c", ".", $wanted_re); - // %f allows two points "-.0.0" but that is the best *simple* expression - } -/* DEBUG YOUR REGEX HERE - var_dump($wanted_re); - print(str_repeat('=', 80) . "\n"); - var_dump($output); -*/ - if (preg_match("/^$wanted_re\$/s", $output)) { - @unlink($tmp_file); - echo "PASS $tested$info\n"; - if (isset($old_php)) { - $php = $old_php; - } - return 'PASSED'; - } - - } else { - $wanted = trim($section_text['EXPECT']); - $wanted = preg_replace('/\r\n/',"\n",$wanted); - // compare and leave on success - $ok = (0 == strcmp($output,$wanted)); - if ($ok) { - @unlink($tmp_file); - echo "PASS $tested$info\n"; - if (isset($old_php)) { - $php = $old_php; - } - return 'PASSED'; - } - } - - // Test failed so we need to report details. - if ($warn) { - echo "WARN $tested$info\n"; - } else { - echo "FAIL $tested$info\n"; - } - - $GLOBALS['__PHP_FAILED_TESTS__'][] = array( - 'name' => $file, - 'test_name' => $tested, - 'output' => @ereg_replace('\.phpt$','.log', $file), - 'diff' => @ereg_replace('\.phpt$','.diff', $file), - 'info' => $info - ); - - // write .exp - if (strpos($log_format,'E') !== FALSE) { - $logname = @ereg_replace('\.phpt$','.exp',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,$wanted); - fclose($log); - } - - // write .out - if (strpos($log_format,'O') !== FALSE) { - $logname = @ereg_replace('\.phpt$','.out',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,$output); - fclose($log); - } - - // write .diff - if (strpos($log_format,'D') !== FALSE) { - $logname = @ereg_replace('\.phpt$','.diff',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,generate_diff($wanted,$output)); - fclose($log); - } - - // write .log - if (strpos($log_format,'L') !== FALSE) { - $logname = @ereg_replace('\.phpt$','.log',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log," ----- EXPECTED OUTPUT -$wanted ----- ACTUAL OUTPUT -$output ----- FAILED -"); - fclose($log); - error_report($file,$logname,$tested); - } - - if (isset($old_php)) { - $php = $old_php; - } - - return $warn ? 'WARNED' : 'FAILED'; -} - -function generate_diff($wanted,$output) -{ - $w = explode("\n", $wanted); - $o = explode("\n", $output); - $w1 = array_diff_assoc($w,$o); - $o1 = array_diff_assoc($o,$w); - $w2 = array(); - $o2 = array(); - foreach($w1 as $idx => $val) $w2[sprintf("%03d<",$idx)] = sprintf("%03d- ", $idx+1).$val; - foreach($o1 as $idx => $val) $o2[sprintf("%03d>",$idx)] = sprintf("%03d+ ", $idx+1).$val; - $diff = array_merge($w2, $o2); - ksort($diff); - return implode("\r\n", $diff); -} - -function error($message) -{ - echo "ERROR: {$message}\n"; - exit(1); -} - -function settings2array($settings, &$ini_settings) -{ - foreach($settings as $setting) { - if (strpos($setting, '=')!==false) { - $setting = explode("=", $setting, 2); - $name = trim(strtolower($setting[0])); - $value = trim($setting[1]); - $ini_settings[$name] = $value; - } - } -} - -function settings2params(&$ini_settings) -{ - if (count($ini_settings)) { - $settings = ''; - foreach($ini_settings as $name => $value) { - $value = addslashes($value); - $settings .= " -d \"$name=$value\""; - } - $ini_settings = $settings; - } else { - $ini_settings = ''; - } -} - -function settings2paramsnoquotes(&$ini_settings) -{ - if (count($ini_settings)) { - $settings = ''; - foreach($ini_settings as $name => $value) { - $value = addslashes($value); - $settings .= " -d $name=$value"; - } - $ini_settings = $settings; - } else { - $ini_settings = ''; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: fdm=marker - * vim: noet sw=4 ts=4 - */ -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/lib/tests-config php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/lib/tests-config --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/lib/tests-config 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/lib/tests-config 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ - NULL, - -/* executable that will be tested. Not used for - web based tests */ -//'TEST_PHP_EXECUTABLE' => '/usr/bin/php', -'TEST_PHP_EXECUTABLE' => '/usr/bin/php', -/* 'TEST_PHP_EXECUTABLE' => 'c:\Programas\php\php.exe', */ - -/* php.ini to use when executing php */ -'PHPRC' => NULL, - -/* log format */ -'TEST_PHP_LOG_FORMAT' => 'LEODC', - -/* debugging detail in output. */ -'TEST_PHP_DETAILED' => 0, - -/* error style for editors or IDE's */ -'TEST_PHP_ERROR_STYLE' => 'EMACS', - -'REPORT_EXIT_STATUS' => 1, -'NO_PHPTEST_SUMMARY' => 0, - -/* don't ask, and don't send results to QA if true */ -'NO_INTERACTION' => true, - -/* base url prefixed to any requests */ -'TEST_WEB_BASE_URL' => NULL, - -/* if set, copy phpt files into this directory, - which should be accessable via an http server. The - TEST_WEB_BASE_URL setting should be the base url - to access this path. If this is not used, - TEST_WEB_BASE_URL should be the base url pointing - to TEST_PHP_SRCDIR, which should then be accessable via - an http server. - - An example would be: - TEST_WEB_BASE_URL=http://localhost/test - TEST_BASE_PATH=/path/to/htdocs/test -*/ -'TEST_BASE_PATH' => NULL, - -/* file extension of pages requested via http - this allows for php to be configured to parse - extensions other than php, usefull for multiple - configurations under a single webserver */ -'TEST_WEB_EXT' => 'php', - -/* if true doesn't run tests, just outputs executable info */ -'TEST_CONTEXT_INFO' => false, - -/* : or ; seperated list of paths */ -'TEST_PATHS' => 'XML_RPC2', -/* 'TEST_PATHS' => 'xmlrpciBackend' */ -/* additional configuration items that may be set - to provide proxy support for testes: - timeout - proxy_host - proxy_port - proxy_user - proxy_pass -*/ -); - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/Makefile php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/Makefile --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/Makefile 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -run-tests: - php lib/run-tests .. - -clean: - find . -name \*.diff | xargs rm -f - find . -name \*.exp | xargs rm -f - find . -name \*.log | xargs rm -f - find . -name \*.out | xargs rm -f - find . -name \*.php | xargs rm -f diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 1) ---SKIPIF-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', $arg); - -?> ---EXPECT-- -CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! -int(19) -CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 2) ---SKIPIF-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false, - 'cachedMethods' => array('foo', 'bar', 'easyStructTest', 'foo2', 'bar2') - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 1) ---SKIPIF-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 2) ---SKIPIF-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true, - 'notCachedMethods' => array('foo', 'bar', 'easyStructTest', 'foobar') - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! -int(19) -CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 3) ---SKIPIF-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 1, - 'cacheByDefault' => true, - 'cachedMethods' => array( - 'foo' => 1, - 'bar' => 2, - 'easyStructTest' => 60 - ) - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -sleep(3); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 4) ---SKIPIF-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true, - 'cachedMethods' => array( - 'foo' => 30, - 'bar' => 10, - 'easyStructTest' => -1, - 'foobar' => 60 - ) - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : called method has a -1 lifetime value => no cache ! -int(19) -CACHE DEBUG : called method has a -1 lifetime value => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ - - * to avoid an extra dependency for a single function. - * - * LICENSE: This source file is subject to version 3.01 of the PHP license - * that is available through the world-wide-web at the following URI: - * http://www.php.net/license/3_01.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. - */ - -require_once('PEAR.php'); -define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); - -/** - * Returns the temp directory according to either the TMP, TMPDIR, or - * TEMP env variables. If these are not set it will also check for the - * existence of /tmp, %WINDIR%\temp - * - * @static - * @access public - * @return string The system tmp directory - */ -function tmpDir() -{ - if (FILE_WIN32) { - if (isset($_ENV['TEMP'])) { - return $_ENV['TEMP']; - } - if (isset($_ENV['TMP'])) { - return $_ENV['TMP']; - } - if (isset($_ENV['windir'])) { - return $_ENV['windir'] . '\\temp'; - } - if (isset($_ENV['SystemRoot'])) { - return $_ENV['SystemRoot'] . '\\temp'; - } - if (isset($_SERVER['TEMP'])) { - return $_SERVER['TEMP']; - } - if (isset($_SERVER['TMP'])) { - return $_SERVER['TMP']; - } - if (isset($_SERVER['windir'])) { - return $_SERVER['windir'] . '\\temp'; - } - if (isset($_SERVER['SystemRoot'])) { - return $_SERVER['SystemRoot'] . '\\temp'; - } - return '\temp'; - } - if (isset($_ENV['TMPDIR'])) { - return $_ENV['TMPDIR']; - } - if (isset($_SERVER['TMPDIR'])) { - return $_SERVER['TMPDIR']; - } - return '/tmp'; -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ - - * to avoid an extra dependency for a single function. - * - * LICENSE: This source file is subject to version 3.01 of the PHP license - * that is available through the world-wide-web at the following URI: - * http://www.php.net/license/3_01.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. - */ - -require_once('PEAR.php'); -define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); - -/** - * Returns the temp directory according to either the TMP, TMPDIR, or - * TEMP env variables. If these are not set it will also check for the - * existence of /tmp, %WINDIR%\temp - * - * @static - * @access public - * @return string The system tmp directory - */ -function tmpDir() -{ - if (FILE_WIN32) { - if (isset($_ENV['TEMP'])) { - return $_ENV['TEMP']; - } - if (isset($_ENV['TMP'])) { - return $_ENV['TMP']; - } - if (isset($_ENV['windir'])) { - return $_ENV['windir'] . '\\temp'; - } - if (isset($_ENV['SystemRoot'])) { - return $_ENV['SystemRoot'] . '\\temp'; - } - if (isset($_SERVER['TEMP'])) { - return $_SERVER['TEMP']; - } - if (isset($_SERVER['TMP'])) { - return $_SERVER['TMP']; - } - if (isset($_SERVER['windir'])) { - return $_SERVER['windir'] . '\\temp'; - } - if (isset($_SERVER['SystemRoot'])) { - return $_SERVER['SystemRoot'] . '\\temp'; - } - return '\temp'; - } - if (isset($_ENV['TMPDIR'])) { - return $_ENV['TMPDIR']; - } - if (isset($_SERVER['TMPDIR'])) { - return $_SERVER['TMPDIR']; - } - return '/tmp'; -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 1) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 2) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 3) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 1) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 2) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ ---TEST-- -PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 3) ---FILE-- - 'validator1.', - 'backend' => 'Php', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against python server returning fault response ---SKIPIF-- - ---FILE-- -invalidMethod('World'); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECT-- -string(60) "exceptions.Exception:method "invalidMethod" is not supported" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.skip.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.skip.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.skip.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/faultFromPython.skip.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/okFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/okFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/okFromPython.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/okFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against python server returning normal response ---SKIPIF-- - ---FILE-- -echo('World')); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (arrayOfStructsTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 - ), - array( - 'moe' => 5, - 'larry' => 2, - 'curly' => 4 - ), - array( - 'moe' => 0, - 'larry' => 1, - 'curly' => 12 - ) -); -$result = $client->arrayOfStructsTest($arg); -var_dump($result); - -?> ---EXPECT-- -int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (countTheEntities) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$string = "foo <<< bar '> && '' #fo>o \" bar"; -$result = $client->countTheEntities($string); -var_dump($result['ctLeftAngleBrackets']); -var_dump($result['ctRightAngleBrackets']); -var_dump($result['ctAmpersands']); -var_dump($result['ctApostrophes']); -var_dump($result['ctQuotes']); - - -?> ---EXPECT-- -int(3) -int(2) -int(2) -int(3) -int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (easyStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); - -?> ---EXPECT-- -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (echoStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->echoStructTest($arg); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["moe"]=> - int(5) - ["larry"]=> - int(6) - ["curly"]=> - int(8) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (manyTypesTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$tmp = "20060116T19:14:03"; -$time = XML_RPC2_Value::createFromNative($tmp, 'datetime'); -$base64 = XML_RPC2_Value::createFromNative('foobar', 'base64'); -$result = $client->manyTypesTest(1, true, 'foo', 3.14159, $time, $base64); -var_dump($result[0]); -var_dump($result[1]); -var_dump($result[2]); -var_dump($result[3]); -var_dump($result[4]->scalar); -var_dump($result[4]->xmlrpc_type); -var_dump($result[4]->timestamp); -var_dump($result[5]->scalar); -var_dump($result[5]->xmlrpc_type); - -?> ---EXPECT-- -int(1) -bool(true) -string(3) "foo" -float(3.14159) -string(17) "20060116T19:14:03" -string(8) "datetime" -int(1137438843) -string(6) "foobar" -string(6) "base64" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (moderateSizeArrayCheck) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$tmp = array('foo'); -for ($i = 0 ; $i<150 ; $i++) { - $tmp[] = "bla bla bla"; -} -$tmp[] = "bar"; -$result = $client->moderateSizeArrayCheck($tmp); -echo($result . "\n"); - -?> ---EXPECT-- -foobar diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (nestedStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); - -$year1999 = array( - '04' => array() -); -$year2001 = $year1999; -$year2000 = $year1999; -$year2000['04']['01'] = array( - 'moe' => 12, - 'larry' => 14, - 'curly' => 9 -); - -$index1999 = '1999 '; -$index2000 = '2000 '; -$index2001 = '2001 '; -$cal = array(); -$cal['1999'] = $year1999; -$cal['2000'] = $year2000; -$cal['2001'] = $year2001; - -require_once('XML/RPC2/Value.php'); -$cal = XML_RPC2_Value::createFromNative($cal, 'struct'); -$result = $client->nestedStructTest($cal); -var_dump($result); - -?> ---EXPECT-- -int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client against phpxmlrpc validator1 (simpleStructReturnTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Php', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$result = $client->simpleStructReturnTest(13); -var_dump($result['times10']); -var_dump($result['times100']); -var_dump($result['times1000']); - -?> ---EXPECT-- -int(130) -int(1300) -int(13000) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/protocolError.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/protocolError.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/protocolError.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/client/protocolError.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ ---TEST-- -PHP Backend XML-RPC client with transport error ---SKIPIF-- - ---FILE-- -invalidMethod('World'); -} catch (XML_RPC2_CurlException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECTREGEX-- -string\(.*\) \"HTTP_Request2_ConnectionException.* diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/array.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/array.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/array.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/array.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ ---TEST-- -Array XML-RPC decoding (Php Backend) ---FILE-- -11a'))->getNativeValue()); -?> ---EXPECT-- -array(3) { - [0]=> - int(1) - [1]=> - bool(true) - [2]=> - string(1) "a" -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/base64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/base64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/base64.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/base64.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ ---TEST-- -Base64 XML-RPC decoding (Php Backend) ---FILE-- -VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c='))->getNativeValue(); -var_dump($result->xmlrpc_type); -var_dump($result->scalar); -?> ---EXPECT-- -string(6) "base64" -string(44) "The quick brown fox jumped over the lazy dog" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/boolean.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/boolean.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/boolean.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/boolean.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ ---TEST-- -Boolean XML-RPC decoding (Php Backend) ---FILE-- -0'))->getNativeValue() ? 'true' : 'false'); -printf("Native value: %s\n", XML_RPC2_Backend_Php_Value::createFromDecode(simplexml_load_string('1'))->getNativeValue() ? 'true' : 'false'); -?> ---EXPECT-- -Native value: false -Native value: true diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/datetime.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/datetime.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/datetime.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/datetime.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ ---TEST-- -Datetime XML-RPC decoding (Php Backend) ---FILE-- -2005'))->getNativeValue(); -var_dump($result->xmlrpc_type); -var_dump($result->scalar); -var_dump($result->timestamp); - -?> ---EXPECT-- -string(8) "datetime" -string(4) "2005" -int(1104537600) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/double.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/double.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/double.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/double.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---TEST-- -Double XML-RPC decoding (Php Backend) ---FILE-- -1.25'))->getNativeValue()); -?> ---EXPECT-- -Native value: 1.25 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ ---TEST-- -Response XML-RPC decoding (Php Backend) ---FILE-- - - - - -faultStringFailed to create homedir with: 0 -faultCode200 - - - -XMLMARKER -))); -} catch (Exception $e) { - var_dump($e->getMessage()); -} -?> ---EXPECT-- -string(32) "Failed to create homedir with: 0" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---TEST-- -Integer XML-RPC decoding (Php Backend) ---FILE-- -7'))->getNativeValue()); -?> ---EXPECT-- -Native value: 7 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer64.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer64.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -Integer XML-RPC decoding (Php Backend) ---SKIPIF-- - ---FILE-- -34359738368'))->getNativeValue()); -?> ---EXPECT-- -Native value: 34359738368 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/integer.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---TEST-- -Integer XML-RPC decoding (Php Backend) ---FILE-- -13'))->getNativeValue()); -?> ---EXPECT-- -Native value: 13 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/null.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/null.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/null.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/null.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ ---TEST-- -Integer XML-RPC decoding (Php Backend) ---FILE-- -'))->getNativeValue(); - -printf("Native value: %s\n", is_null($value) ? 'null' : 'not null'); -?> ---EXPECT-- -Native value: null diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/request.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/request.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/request.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/request.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ---TEST-- -Request XML-RPC decoding (Php Backend) ---FILE-- -foo.bara string125125.21997071619203010')); -var_dump($request->getMethodName()); -$result = ($request->getParameters()); -var_dump($result[0]); -var_dump($result[1]); -var_dump($result[2]); -var_dump($result[3]->timestamp); -var_dump($result[3]->xmlrpc_type); -var_dump($result[3]->scalar); -var_dump($result[4]); -var_dump($result[5]); - -?> ---EXPECT-- -string(7) "foo.bar" -string(8) "a string" -int(125) -float(125.2) -int(869011200) -string(8) "datetime" -string(14) "19970716192030" -bool(true) -bool(false) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/response.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/response.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/response.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/response.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ ---TEST-- -Response XML-RPC decoding (Php Backend) ---FILE-- -South Dakota'))); -?> ---EXPECT-- -string(12) "South Dakota" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/string.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/string.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/string.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/string.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ ---TEST-- -String XML-RPC decoding (Php Backend) ---FILE-- -The quick brown fox jumped over the lazy dog'))->getNativeValue()); -printf("Native value: %s\n", XML_RPC2_Backend_Php_Value::createFromDecode(simplexml_load_string('The quick brown fox jumped over the lazy dog'))->getNativeValue()); -?> ---EXPECT-- -Native value: The quick brown fox jumped over the lazy dog -Native value: The quick brown fox jumped over the lazy dog diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/struct.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/struct.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/struct.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/decoding/struct.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ ---TEST-- -Struct XML-RPC decoding (Php Backend) ---FILE-- -a1b1ca string'))->getNativeValue()); -?> ---EXPECT-- -array(3) { - ["a"]=> - int(1) - ["b"]=> - bool(true) - ["c"]=> - string(8) "a string" -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/array.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/array.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/array.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/array.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Array XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(130) "11a string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/base64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/base64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/base64.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/base64.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -Base64 XML-RPC encoding (Php Backend) ---FILE-- -encode()); -$string = new XML_RPC2_Backend_Php_Value_Base64('The brown fox jumped over the lazy dog'); -var_dump($string->encode()); -?> ---EXPECT-- -string(77) "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c=" -string(81) "VGhlIDxxdWljaz4gYnJvd24gZm94IGp1bXBlZCBvdmVyIHRoZSBsYXp5IGRvZw==" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/boolean.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/boolean.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/boolean.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/boolean.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -Boolean XML-RPC encoding (Php Backend) ---FILE-- -encode()); -$bool = new XML_RPC2_Backend_Php_Value_Boolean(false); -var_dump($bool->encode()); -?> ---EXPECT-- -string(20) "1" -string(20) "0" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Datetime XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(65) "1997-01-16T19:20:30.45+01:00" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Datetime XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(60) "1997-01-16T19:20:30.45Z" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Datetime XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(41) "2001" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Datetime XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(47) "1997-01-16" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/datetime.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ ---TEST-- -Datetime XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(54) "19970116T18:20:30" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/double.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/double.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/double.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/double.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -Double XML-RPC encoding (Php Backend) ---FILE-- -encode()); -$double = new XML_RPC2_Backend_Php_Value_Double(123.79); -var_dump($double->encode()); -?> ---EXPECT-- -string(18) "0" -string(23) "123.79" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer64.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer64.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ---TEST-- -Integer XML-RPC encoding (Php Backend) ---SKIPIF-- - ---FILE-- -encode()); -?> ---EXPECT-- -string(20) "34359738368" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/integer.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Integer XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(13) "53" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/null.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/null.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/null.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/null.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Nil XML-RPC encoding (Php Backend) ---FILE-- -encode()); -?> ---EXPECT-- -string(11) "" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/request.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/request.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/request.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/request.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ ---TEST-- -Request XML-RPC encoding (Php Backend) ---FILE-- -addParameter('a string'); -$request->addParameter(125); -$request->addParameter(125.2); -$request->addParameter(new XML_RPC2_Backend_Php_Value_Datetime('2005-01-03')); -$request->addParameter(true); -$request->addParameter(false); -var_dump($request->encode()); -?> ---EXPECT-- -string(441) " -foo.bara string125125.22005-01-0310" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Request XML-RPC encoding (Php Backend) ---FILE-- - ---EXPECT-- -string(272) " -faultCode2faultStringA fault string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/response.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Request XML-RPC encoding (Php Backend) ---FILE-- - ---EXPECT-- -string(249) " -11a string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/string.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/string.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/string.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/string.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -String XML-RPC encoding (Php Backend) ---FILE-- -encode()); -$string = new XML_RPC2_Backend_Php_Value_String('The brown fox jumped over the lazy dog'); -var_dump($string->encode()); -?> ---EXPECT-- -string(61) "The quick brown fox jumped over the lazy dog" -string(69) "The <quick> brown fox jumped over the lazy dog" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/struct.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/struct.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/struct.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/encoding/struct.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---TEST-- -Struct XML-RPC encoding (Php Backend) ---FILE-- - 1, 'b' => true, 'c' => 'a string')); -var_dump($struct->encode()); -?> ---EXPECT-- -string(212) "a1b1ca string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/regressions/11135.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/regressions/11135.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/regressions/11135.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/regressions/11135.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ ---TEST-- -Regression guard against bug 11135: Empty array should not trigger notice ---FILE-- -createFromNative(array()); -} - -?> ---EXPECT-- diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server with non-existant method response ---FILE-- - - - echoecho - World - -EOS -; -$response = $server->getResponse(); -try { - XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECT-- -string(27) "Unable to parse request XML" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server with non-existant method response ---FILE-- - - - example - World - -EOS -; -$response = $server->getResponse(); -try { - XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getFaultCode()); - var_dump($e->getMessage()); -} -?> ---EXPECT-- -int(-32601) -string(40) "server error. requested method not found" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server with normal response ---FILE-- - - - echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server with normal response (with prefix in phpdoc) ---FILE-- - - - prefixed.echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" \ No newline at end of file diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server with normal response (with prefix) ---FILE-- - 'prefixed.')); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - - prefixed.echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (arrayOfStructsTest) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.arrayOfStructsTest - - - - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - - moe - - 5 - - - - larry - - 2 - - - - curly - - 4 - - - - - - - - moe - - 0 - - - - larry - - 1 - - - - curly - - 12 - - - - - - - - - - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (countTheEntities) ---FILE-- -'); - $ctAmpersands = substr_count($string, '&'); - $ctApostrophes = substr_count($string, "'"); - $ctQuotes = substr_count($string, '"'); - return array( - 'ctLeftAngleBrackets' => $ctLeftAngleBrackets, - 'ctRightAngleBrackets' => $ctRightAngleBrackets, - 'ctAmpersands' => $ctAmpersands, - 'ctApostrophes' => $ctApostrophes, - 'ctQuotes' => $ctQuotes - ); - } -} - -set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); -require_once 'XML/RPC2/Server.php'; -$options = array( - 'prefix' => 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.countTheEntities - - - - foo <<< bar '> && '' #fo>o " bar - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result['ctLeftAngleBrackets']); -var_dump($result['ctRightAngleBrackets']); -var_dump($result['ctAmpersands']); -var_dump($result['ctApostrophes']); -var_dump($result['ctQuotes']); - -?> ---EXPECT-- -int(3) -int(2) -int(2) -int(3) -int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (easyStructTest) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (echoStructTest) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.echoStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["moe"]=> - int(5) - ["larry"]=> - int(6) - ["curly"]=> - int(8) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (manyTypesTest) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.manyTypesTest - - - - 1 - - - - - 1 - - - - - foo - - - - - 3.141590 - - - - - 20060116T19:14:03 - - - - - Zm9vYmFy - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result[0]); -var_dump($result[1]); -var_dump($result[2]); -var_dump($result[3]); -var_dump($result[4]->xmlrpc_type); -var_dump($result[4]->scalar); -var_dump($result[4]->timestamp); -var_dump($result[5]->xmlrpc_type); -var_dump($result[5]->scalar); - -?> ---EXPECT-- -int(1) -bool(true) -string(3) "foo" -float(3.14159) -string(8) "datetime" -string(17) "20060116T19:14:03" -int(1137438843) -string(6) "base64" -string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,506 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (moderateSizeArrayCheck) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.moderateSizeArrayCheck - - - - - - - foo - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bar - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (nestedStructTest) ---FILE-- - 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.nestedStructTest - - - - - - 1999 - - - - 04 - - - - - - - - - - - 2000 - - - - 04 - - - - 01 - - - - moe - - 12 - - - - larry - - 14 - - - - curly - - 9 - - - - - - - - - - - - - 2001 - - - - 04 - - - - - - - - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ ---TEST-- -PHP Backend XML-RPC server Validator1 test (simpleStructReturnTest) ---FILE-- - 10 * $int, - 'times100' => 100 * $int, - 'times1000' => 1000 * $int - ); - } -} - -set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); -require_once 'XML/RPC2/Server.php'; -$options = array( - 'prefix' => 'validator1.', - 'backend' => 'Php' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.simpleStructReturnTest - - - - 13 - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["times10"]=> - int(130) - ["times100"]=> - int(1300) - ["times1000"]=> - int(13000) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/11314.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/11314.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/11314.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/11314.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ ---TEST-- -Bug #11314: Following codesniffer standards param docs mess up ---FILE-- - - - * @copyright 2007 Lars Olesen - * @license GPL http://www.opensource.org/licenses/gpl-license.php - * @version @package-version@ - * @link http://pear.php.net/package/XML_RPC2 - */ -require_once 'XML/RPC2/Server.php'; - -/** - * The implementation - * - * @category XML - * @package XML_RPC2 - * @author Lars Olesen - * @copyright 2007 Lars Olesen - * @license GPL http://www.opensource.org/licenses/gpl-license.php - * @version @package-version@ - * @link http://pear.php.net/package/XML_RPC2 - */ -class DocumentationServer { - - /** - * returns something - * - * @param array $something A description - * @param string $another_thing A description of another thing - * @param boolean $return Whether to return nothing - server doesn't care though - * - * @return string An international string - */ - public static function getSomething($something, $another_thing, $credentials) { - return 'nothing interesting'; - } - -} - -$options = array( - 'prefix' => 'test.', - 'encoding' => 'utf-8' -); - -$server = XML_RPC2_Server::create('DocumentationServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = ''; -$server->handleCall(); -?> ---EXPECT-- - - - - - Available XMLRPC methods for this server - - - -

Available XMLRPC methods for this server

-

Index

- -

Details

-
-

(string) test.getSomething((array) something, (string) another_thing, (boolean) credentials)

-

Description :

-
- returns something -
-

Parameters :

- - - - - -
TypeNameDocumentation
arraysomethingA description
stringanother_thingA description of another thing
booleancredentialsWhether to return nothing - server doesn't care though
-

(return to index)

-
- - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/14038.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/14038.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/14038.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/14038.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ ---TEST-- -Empty array should not trigger notice ---FILE-- -createFromNative(array()); -} ---EXPECT-- diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/18258.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/18258.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/18258.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/regressions/18258.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ ---TEST-- -Request #18258 Can not call remote function called create() because XML_RPC2_Client::create() ---FILE-- - 'test.', - 'encoding' => 'utf-8' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$request = new XML_RPC2_Backend_Php_Request('test.create'); -$request->addParameter(12); -$GLOBALS['HTTP_RAW_POST_DATA'] = $request->encode(); -$server->handleCall(); -?> ---EXPECT-- - -12 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 1) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', $arg); - -?> ---EXPECT-- -CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! -int(19) -CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 2) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => $dir, - 'lifetime' => 60, - 'cacheByDefault' => false, - 'cachedMethods' => array('foo', 'bar', 'easyStructTest', 'foo2', 'bar2') - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); -@rmdir($dir); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 1) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => $dir, - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); -@rmdir($dir); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 2) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true, - 'notCachedMethods' => array('foo', 'bar', 'easyStructTest', 'foobar') - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! -int(19) -CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 3) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => $dir, - 'lifetime' => 1, - 'cacheByDefault' => true, - 'cachedMethods' => array( - 'foo' => 1, - 'bar' => 2, - 'easyStructTest' => 60 - ) - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -sleep(3); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); -@rmdir($dir); - -?> ---EXPECT-- -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 4) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true, - 'cachedMethods' => array( - 'foo' => 30, - 'bar' => 10, - 'easyStructTest' => -1, - 'foobar' => 60 - ) - ), - 'cacheDebug' => true -); - -$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); -$result = $client->easyStructTest($arg); -var_dump($result); -$client->dropCacheFile___('easyStructTest', array($arg)); - -?> ---EXPECT-- -CACHE DEBUG : called method has a -1 lifetime value => no cache ! -int(19) -CACHE DEBUG : called method has a -1 lifetime value => no cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ - - * to avoid an extra dependency for a single function. - * - * LICENSE: This source file is subject to version 3.01 of the PHP license - * that is available through the world-wide-web at the following URI: - * http://www.php.net/license/3_01.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. - */ - -require_once('PEAR.php'); -define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); - -/** - * Returns the temp directory according to either the TMP, TMPDIR, or - * TEMP env variables. If these are not set it will also check for the - * existence of /tmp, %WINDIR%\temp - * - * @static - * @access public - * @return string The system tmp directory - */ -function tmpDir() -{ - if (FILE_WIN32) { - if (isset($_ENV['TEMP'])) { - return $_ENV['TEMP']; - } - if (isset($_ENV['TMP'])) { - return $_ENV['TMP']; - } - if (isset($_ENV['windir'])) { - return $_ENV['windir'] . '\\temp'; - } - if (isset($_ENV['SystemRoot'])) { - return $_ENV['SystemRoot'] . '\\temp'; - } - if (isset($_SERVER['TEMP'])) { - return $_SERVER['TEMP']; - } - if (isset($_SERVER['TMP'])) { - return $_SERVER['TMP']; - } - if (isset($_SERVER['windir'])) { - return $_SERVER['windir'] . '\\temp'; - } - if (isset($_SERVER['SystemRoot'])) { - return $_SERVER['SystemRoot'] . '\\temp'; - } - return '\temp'; - } - if (isset($_ENV['TMPDIR'])) { - return $_ENV['TMPDIR']; - } - if (isset($_SERVER['TMPDIR'])) { - return $_SERVER['TMPDIR']; - } - return '/tmp'; -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ - - * to avoid an extra dependency for a single function. - * - * LICENSE: This source file is subject to version 3.01 of the PHP license - * that is available through the world-wide-web at the following URI: - * http://www.php.net/license/3_01.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. - */ - -require_once('PEAR.php'); -define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); - -/** - * Returns the temp directory according to either the TMP, TMPDIR, or - * TEMP env variables. If these are not set it will also check for the - * existence of /tmp, %WINDIR%\temp - * - * @static - * @access public - * @return string The system tmp directory - */ -function tmpDir() -{ - if (FILE_WIN32) { - if (isset($_ENV['TEMP'])) { - return $_ENV['TEMP']; - } - if (isset($_ENV['TMP'])) { - return $_ENV['TMP']; - } - if (isset($_ENV['windir'])) { - return $_ENV['windir'] . '\\temp'; - } - if (isset($_ENV['SystemRoot'])) { - return $_ENV['SystemRoot'] . '\\temp'; - } - if (isset($_SERVER['TEMP'])) { - return $_SERVER['TEMP']; - } - if (isset($_SERVER['TMP'])) { - return $_SERVER['TMP']; - } - if (isset($_SERVER['windir'])) { - return $_SERVER['windir'] . '\\temp'; - } - if (isset($_SERVER['SystemRoot'])) { - return $_SERVER['SystemRoot'] . '\\temp'; - } - return '\temp'; - } - if (isset($_ENV['TMPDIR'])) { - return $_ENV['TMPDIR']; - } - if (isset($_SERVER['TMPDIR'])) { - return $_SERVER['TMPDIR']; - } - return '/tmp'; -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 1) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 2) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 3) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => false - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=false, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 1) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is not hit ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 -CACHE DEBUG : cache is hit ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 2) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 3) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext', - 'cacheOptions' => array( - 'cacheDir' => tmpDir() . '/', - 'lifetime' => 60, - 'cacheByDefault' => true - ), - 'cacheDebug' => true -); - -$server = XML_RPC2_CachedServer::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); -$server->clean(); - -?> ---EXPECT-- -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 -CACHE DEBUG : we don't cache ! -int(19) -CACHE DEBUG : default values => weCache=true, lifetime=60 -CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 -CACHE DEBUG : we don't cache ! -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against python server returning fault response ---SKIPIF-- - ---FILE-- -invalidMethod('World'); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECT-- -string(60) "exceptions.Exception:method "invalidMethod" is not supported" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against python server returning normal response ---SKIPIF-- - ---FILE-- -echo('World')); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (arrayOfStructsTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 - ), - array( - 'moe' => 5, - 'larry' => 2, - 'curly' => 4 - ), - array( - 'moe' => 0, - 'larry' => 1, - 'curly' => 12 - ) -); -$result = $client->arrayOfStructsTest($arg); -var_dump($result); - -?> ---EXPECT-- -int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (countTheEntities) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$string = "foo <<< bar '> && '' #fo>o \" bar"; -$result = $client->countTheEntities($string); -var_dump($result['ctLeftAngleBrackets']); -var_dump($result['ctRightAngleBrackets']); -var_dump($result['ctAmpersands']); -var_dump($result['ctApostrophes']); -var_dump($result['ctQuotes']); - - -?> ---EXPECT-- -int(3) -int(2) -int(2) -int(3) -int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (easyStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->easyStructTest($arg); -var_dump($result); - -?> ---EXPECT-- -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (echoStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$arg = array( - 'moe' => 5, - 'larry' => 6, - 'curly' => 8 -); -$result = $client->echoStructTest($arg); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["moe"]=> - int(5) - ["larry"]=> - int(6) - ["curly"]=> - int(8) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (manyTypesTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$tmp = "20060116T19:14:03"; -$time = XML_RPC2_Value::createFromNative($tmp, 'datetime'); -$base64 = XML_RPC2_Value::createFromNative('foobar', 'base64'); -$result = $client->manyTypesTest(1, true, 'foo', 3.14159, $time, $base64); -var_dump($result[0]); -var_dump($result[1]); -var_dump($result[2]); -var_dump($result[3]); -var_dump($result[4]->scalar); -var_dump($result[4]->xmlrpc_type); -var_dump($result[4]->timestamp); -var_dump($result[5]->scalar); -var_dump($result[5]->xmlrpc_type); - -?> ---EXPECT-- -int(1) -bool(true) -string(3) "foo" -float(3.14159) -string(17) "20060116T19:14:03" -string(8) "datetime" -int(1137438843) -string(6) "foobar" -string(6) "base64" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (moderateSizeArrayCheck) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$tmp = array('foo'); -for ($i = 0 ; $i<150 ; $i++) { - $tmp[] = "bla bla bla"; -} -$tmp[] = "bar"; -$result = $client->moderateSizeArrayCheck($tmp); -echo($result . "\n"); - -?> ---EXPECT-- -foobar diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (nestedStructTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); - -$year1999 = array( - '04' => array() -); -$year2001 = $year1999; -$year2000 = $year1999; -$year2000['04']['01'] = array( - 'moe' => 12, - 'larry' => 14, - 'curly' => 9 -); - -$index1999 = '1999 '; -$index2000 = '2000 '; -$index2001 = '2001 '; -$cal = array(); -$cal['1999'] = $year1999; -$cal['2000'] = $year2000; -$cal['2001'] = $year2001; - -require_once('XML/RPC2/Value.php'); -$cal = XML_RPC2_Value::createFromNative($cal, 'struct'); -$result = $client->nestedStructTest($cal); -var_dump($result); - -?> ---EXPECT-- -int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (simpleStructReturnTest) ---SKIPIF-- - ---FILE-- - false, - 'backend' => 'Xmlrpcext', - 'prefix' => 'validator1.' -); -$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); -$result = $client->simpleStructReturnTest(13); -var_dump($result['times10']); -var_dump($result['times100']); -var_dump($result['times1000']); - -?> ---EXPECT-- -int(130) -int(1300) -int(13000) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC client with transport error ---SKIPIF-- - ---FILE-- -invalidMethod('World'); -} catch (XML_RPC2_CurlException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECTREGEX-- -string\(.*\) \"HTTP_Request2_ConnectionException.* diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ ---TEST-- -XMLRPCext backend test setting explicit type for value ---SKIPIF-- - ---FILE-- - ---EXPECT-- -object(stdClass)#1 (2) { - ["scalar"]=> - string(11) "Hello World" - ["xmlrpc_type"]=> - string(6) "base64" -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server with normal response ---SKIPIF-- - - - moo - World - -EOS -; -try { - $response = $server->getResponse(); - //print($response); - //XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getMessage()); -} -?> ---EXPECT-- -string(36) "server error. method not found. - -moo" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server with normal response ---SKIPIF-- - ---FILE-- - - - moo - World - -EOS -; -$response = $server->getResponse(); -try { - XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); -} catch (XML_RPC2_FaultException $e) { - var_dump($e->getFaultCode()); - var_dump($e->getMessage()); -} - -?> ---EXPECT-- -int(-32601) -string(40) "server error. requested method not found" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server with normal response ---SKIPIF-- - ---FILE-- - - - echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server with normal response (with prefix in phpdoc) ---SKIPIF-- - ---FILE-- - - - prefixed.echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server with normal response (with prefix) ---SKIPIF-- - ---FILE-- - 'prefixed.')); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - - prefixed.echoecho - World - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (arrayOfStructsTest) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.arrayOfStructsTest - - - - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - - moe - - 5 - - - - larry - - 2 - - - - curly - - 4 - - - - - - - - moe - - 0 - - - - larry - - 1 - - - - curly - - 12 - - - - - - - - - - -EOS -; -$response = $server->getResponse(); -var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -?> ---EXPECT-- -int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (countTheEntities) ---SKIPIF-- - ---FILE-- -'); - $ctAmpersands = substr_count($string, '&'); - $ctApostrophes = substr_count($string, "'"); - $ctQuotes = substr_count($string, '"'); - return array( - 'ctLeftAngleBrackets' => $ctLeftAngleBrackets, - 'ctRightAngleBrackets' => $ctRightAngleBrackets, - 'ctAmpersands' => $ctAmpersands, - 'ctApostrophes' => $ctApostrophes, - 'ctQuotes' => $ctQuotes - ); - } -} - -set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); -require_once 'XML/RPC2/Server.php'; -$options = array( - 'prefix' => 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.countTheEntities - - - - foo <<< bar '> && '' #fo>o " bar - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result['ctLeftAngleBrackets']); -var_dump($result['ctRightAngleBrackets']); -var_dump($result['ctAmpersands']); -var_dump($result['ctApostrophes']); -var_dump($result['ctQuotes']); - -?> ---EXPECT-- -int(3) -int(2) -int(2) -int(3) -int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (easyStructTest) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.easyStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (echoStructTest) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.echoStructTest - - - - - - moe - - 5 - - - - larry - - 6 - - - - curly - - 8 - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["moe"]=> - int(5) - ["larry"]=> - int(6) - ["curly"]=> - int(8) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (manyTypesTest) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.manyTypesTest - - - - 1 - - - - - 1 - - - - - foo - - - - - 3.141590 - - - - - 20060116T19:14:03 - - - - - Zm9vYmFy - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result[0]); -var_dump($result[1]); -var_dump($result[2]); -var_dump($result[3]); -var_dump($result[4]->xmlrpc_type); -var_dump($result[4]->scalar); -var_dump($result[4]->timestamp); -var_dump($result[5]->xmlrpc_type); -var_dump($result[5]->scalar); - -?> ---EXPECT-- -int(1) -bool(true) -string(3) "foo" -float(3.14159) -string(8) "datetime" -string(17) "20060116T19:14:03" -int(1137438843) -string(6) "base64" -string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,512 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (moderateSizeArrayCheck) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.moderateSizeArrayCheck - - - - - - - foo - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bla bla bla - - - bar - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (nestedStructTest) ---SKIPIF-- - ---FILE-- - 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.nestedStructTest - - - - - - 1999 - - - - 04 - - - - - - - - - - - 2000 - - - - 04 - - - - 01 - - - - moe - - 12 - - - - larry - - 14 - - - - curly - - 9 - - - - - - - - - - - - - 2001 - - - - 04 - - - - - - - - - - - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ ---TEST-- -XMLRPCext Backend XML-RPC server Validator1 test (simpleStructReturnTest) ---SKIPIF-- - ---FILE-- - 10 * $int, - 'times100' => 100 * $int, - 'times1000' => 1000 * $int - ); - } -} - -set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); -require_once 'XML/RPC2/Server.php'; -$options = array( - 'prefix' => 'validator1.', - 'backend' => 'Xmlrpcext' -); - -$server = XML_RPC2_Server::create('TestServer', $options); -$GLOBALS['HTTP_RAW_POST_DATA'] = << - -validator1.simpleStructReturnTest - - - - 13 - - - - -EOS -; -$response = $server->getResponse(); -$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); -var_dump($result); - -?> ---EXPECT-- -array(3) { - ["times10"]=> - int(130) - ["times100"]=> - int(1300) - ["times1000"]=> - int(13000) -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Client.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Client.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Util/HTTPRequest.php'; -require_once 'XML/RPC2/Value.php'; -require_once 'XML/RPC2/Client.php'; -require_once 'XML/RPC2/Backend/Php/Request.php'; -require_once 'XML/RPC2/Backend/Php/Response.php'; -// }}} - -/** - * XML_RPC client backend class. This is the default, all-php XML_RPC client backend. - * - * This backend does not require the xmlrpc extension to be compiled in. It implements - * XML_RPC based on the always present DOM and SimpleXML PHP5 extensions. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Client extends XML_RPC2_Client -{ - - // {{{ constructor - - /** - * Construct a new XML_RPC2_Client PHP Backend. - * - * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). - * Optionally, some options may be set - * - * @param string URI for the XML-RPC server - * @param array (optional) Associative array of options - */ - public function __construct($uri, $options = array()) - { - parent::__construct($uri, $options); - if ($this->encoding != 'utf-8') throw new XML_RPC2_Exception('XML_RPC2_Backend_Php does not support any encoding other than utf-8, due to a simplexml limitation'); - } - - // }}} - // {{{ __call() - - /** - * __call Catchall. This method catches remote method calls and provides for remote forwarding. - * - * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to - * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value - * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative - * proves inacurate -- as when encoding DateTime values -- you should present an instance of - * XML_RPC_Value in lieu of the native parameter. - * - * @param string Method name - * @param array Parameters - * @return mixed The call result, already decoded into native types - */ - public function __call($methodName, $parameters) - { - $request = new XML_RPC2_Backend_Php_Request($this->prefix . $methodName, $this->encoding); - $request->setParameters($parameters); - $request = $request->encode(); - $uri = $this->uri; - $options = array( - 'encoding' => $this->encoding, - 'proxy' => $this->proxy, - 'sslverify' => $this->sslverify, - 'connectionTimeout' => $this->connectionTimeout - ); - if (isset($this->httpRequest)) $options['httpRequest'] = $this->httpRequest; - $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options); - $httpRequest->setPostData($request); - $httpRequest->sendRequest(); - $body = $httpRequest->getBody(); - if ($this->debug) { - XML_RPC2_ClientHelper::printPreParseDebugInfo($request, $body); - } - try { - $document = new SimpleXMLElement($body); - $result = XML_RPC2_Backend_Php_Response::decode($document); - } catch (XML_RPC2_Exception $e) { - if ($this->debug) { - if (get_class($e)=='XML_RPC2_FaultException') { - print "XML_RPC2_FaultException #" . $e->getFaultCode() . " : " . $e->getMessage(); - } else { - print get_class($e) . " : " . $e->getMessage(); - } - } - throw $e; - } - if ($this->debug) { - XML_RPC2_ClientHelper::printPostRequestDebugInformation($result); - } - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Request.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Request.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Request.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Request.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,205 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value.php'; -// }}} - -/** - * XML_RPC request backend class. This class represents an XML_RPC request, exposing the methods - * needed to encode/decode a request. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Request -{ - // {{{ properties - - /** - * Name of requested method - * - * @var mixed - */ - private $_methodName = ''; - - /** - * request parameters - * - * @var array - */ - private $_parameters = null; - - /** - * encoding of the request - * - * @var string - */ - private $_encoding = 'utf-8'; - - // }}} - // {{{ setParameters() - - /** - * parameters property setter - * - * @param mixed value The new parameters - */ - public function setParameters($value) - { - $this->_parameters = $value; - } - - // }}} - // {{{ addParameter() - - /** - * parameters property appender - * - * @param mixed value The new parameter - */ - public function addParameter($value) - { - $this->_parameters[] = $value; - } - - // }}} - // {{{ getParameters() - - /** - * parameters property getter - * - * @return mixed The current parameters - */ - public function getParameters() - { - return $this->_parameters; - } - - // }}} - // {{{ getMethodName() - - /** - * method name getter - * - * @return string method name - */ - public function getMethodName() - { - return $this->_methodName; - } - - // }}} - // {{{ constructor - - /** - * Create a new xml-rpc request with the provided methodname - * - * @param string Name of method targeted by this xml-rpc request - * @param string encoding of the request - */ - function __construct($methodName, $encoding = 'utf-8') - { - $this->_methodName = $methodName; - $this->setParameters(array()); - $this->_encoding = $encoding; - } - - // }}} - // {{{ encode() - - /** - * Encode the request for transmission. - * - * @return string XML-encoded request (a full XML document) - */ - public function encode() - { - $methodName = $this->_methodName; - $parameters = $this->getParameters(); - - $result = '_encoding . '"?>' . "\n"; - $result .= ""; - $result .= "${methodName}"; - $result .= ""; - foreach($parameters as $parameter) { - $result .= ""; - $result .= ($parameter instanceof XML_RPC2_Backend_Php_Value) ? $parameter->encode() : XML_RPC2_Backend_Php_Value::createFromNative($parameter)->encode(); - $result .= ""; - } - $result .= ""; - $result .= ""; - return $result; - } - - // }}} - // {{{ createFromDecode() - - /** - * Decode a request from XML and construct a request object with the createFromDecoded values - * - * @param SimpleXMLElement The encoded XML-RPC request. - * @return XML_RPC2_Backend_Php_Request The xml-rpc request, represented as an object instance - */ - public static function createFromDecode($simpleXML) - { - $methodName = (string) $simpleXML->methodName; - $params = array(); - foreach ($simpleXML->params->param as $param) { - foreach ($param->value as $value) { - $params[] = XML_RPC2_Backend_Php_Value::createFromDecode($value)->getNativeValue(); - } - } - $result = new XML_RPC2_Backend_Php_Request($methodName); - $result->setParameters($params); - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Response.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Response.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Response.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Response.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value.php'; -require_once 'XML/RPC2/Backend/Php/Value/Struct.php'; -// }}} - -/** - * XML-RPC response backend class. - * - * This class represents an XML_RPC request, exposing the methods - * needed to encode/decode an xml-rpc response. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Response -{ - - // {{{ encode() - - /** - * Encode a normal XML-RPC response, containing the provided value - * - * You may supply a php-native value, or an XML_RPC2_Backend_Php_Value instance, to be returned. Usually providing a native value - * is more convenient. However, for some types, XML_RPC2_Backend_Php_Value::createFromNative can't properly choose the xml-rpc - * type. In these cases, constructing an XML_RPC2_Backend_Php_Value and using it as param here is the only way to return the desired - * type. - * - * @see http://www.xmlrpc.com/spec - * @see XML_RPC2_Backend_Php_Value::createFromNative - * @param mixed $param The result value which the response will envelop - * @param string $encoding encoding - * @return string The XML payload - */ - public static function encode($param, $encoding = 'utf-8') - { - if (!$param instanceof XML_RPC2_Backend_Php_Value) { - $param = XML_RPC2_Backend_Php_Value::createFromNative($param); - } - $result = '' . "\n"; - $result .= '' . $param->encode() . ''; - return $result; - } - - // }}} - // {{{ encodeFault() - - /** - * Encode a fault XML-RPC response, containing the provided code and message - * - * @see http://www.xmlrpc.com/spec - * @param int $code Response code - * @param string $message Response message - * @param string $encoding encoding - * @return string The XML payload - */ - public static function encodeFault($code, $message, $encoding = 'utf-8') - { - $value = new XML_RPC2_Backend_Php_Value_Struct(array('faultCode' => (int) $code, 'faultString' => (string) $message)); - $result = '' . "\n"; - $result .= '' . $value->encode() . ''; - return $result; - } - - // }}} - // {{{ decode() - - /** - * Parse a response and either return the native PHP result. - * - * This method receives an XML-RPC response document, in SimpleXML format, decodes it and returns the payload value. - * - * @param SimpleXmlElement $xml The Transport XML - * @return mixed The response payload - * - * @see http://www.xmlrpc.com/spec - * @throws XML_RPC2_FaultException Signals the decoded response was an XML-RPC fault - * @throws XML_RPC2_DecodeException Signals an ill formed payload response section - */ - public static function decode(SimpleXMLElement $xml) - { - $faultNode = $xml->xpath('/methodResponse/fault'); - if (count($faultNode) == 1) { - throw XML_RPC2_FaultException::createFromDecode($faultNode[0]); - } - $paramValueNode = $xml->xpath('/methodResponse/params/param/value'); - if (count($paramValueNode) == 1) { - return XML_RPC2_Backend_Php_Value::createFromDecode($paramValueNode[0])->getNativeValue(); - } - throw new XML_RPC2_DecodeException('Unable to decode xml-rpc response. No fault nor params/param elements found'); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Server.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Server.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Backend/Php/Request.php'; -require_once 'XML/RPC2/Backend/Php/Response.php'; -require_once 'XML/RPC2/Exception.php'; -// }}} - -/** - * XML_RPC server class PHP-only backend. - * - * The XML_RPC2_Server does the work of decoding and encoding xml-rpc request and response. The actual - * method execution is delegated to the call handler instance. - * - * The XML_RPC server is responsible for decoding the request and calling the appropriate method in the - * call handler class. It then encodes the result into an XML-RPC response and returns it to the client. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Server extends XML_RPC2_Server -{ - - // {{{ constructor - - /** - * Create a new XML-RPC Server. - * - * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual - * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client - * - * @param object $callHandler - * @param array $options associative array of options - * @access public - */ - function __construct($callHandler, $options = array()) - { - parent::__construct($callHandler, $options); - if (strtolower($this->encoding) != 'utf-8') { - throw new XML_RPC2_Exception('XML_RPC2_Backend_Php does not support any encoding other than utf-8, due to a simplexml limitation'); - } - } - - // }}} - // {{{ handleCall() - - /** - * Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response. - * - */ - public function handleCall() - { - if ($this->autoDocument && $this->input->isEmpty()) { - $this->autoDocument(); - } else { - $response = $this->getResponse(); - header('Content-type: text/xml; charset=' . strtolower($this->encoding)); - header('Content-length: ' . $this->getContentLength($response)); - print $response; - } - } - - // }}} - // {{{ getResponse() - - /** - * Get the XML response of the XMLRPC server - * - * @return string XML response - */ - public function getResponse() - { - try { - set_error_handler(array('XML_RPC2_Backend_Php_Server', 'errorToException')); - $request = @simplexml_load_string($this->input->readRequest()); - // TODO : do not use exception but a XMLRPC error ! - if (!is_object($request)) throw new XML_RPC2_FaultException('Unable to parse request XML', 0); - $request = XML_RPC2_Backend_Php_Request::createFromDecode($request); - $methodName = $request->getMethodName(); - $arguments = $request->getParameters(); - if ($this->signatureChecking) { - $method = $this->callHandler->getMethod($methodName); - if (!($method)) { - // see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes - return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found')); - } - if (!($method->matchesSignature($methodName, $arguments))) { - return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters')); - } - } - restore_error_handler(); - return (XML_RPC2_Backend_Php_Response::encode(call_user_func_array(array($this->callHandler, $methodName), $arguments), $this->encoding)); - } catch (XML_RPC2_FaultException $e) { - return (XML_RPC2_Backend_Php_Response::encodeFault($e->getFaultCode(), $e->getMessage(), $this->encoding)); - } catch (Exception $e) { - if (ini_get('display_errors') == 1) { - return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage() . $e->getTraceAsString(), $this->encoding)); - } else { - return XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled PHP Exception', $this->encoding); - } - } - } - -} -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Array.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Array.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Array.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Array.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value.php'; -// }}} - -/** - * XML_RPC array value class. Represents values of type array - * - * @author Sergio Carvalho - * @package XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Array extends XML_RPC2_Backend_Php_Value -{ - - // {{{ setNativeValue() - - /** - * nativeValue property setter - * - * @param mixed value the new nativeValue - */ - protected function setNativeValue($value) - { - if (!is_array($value)) { - throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Value_Array from type \'%s\'.', gettype($nativeValue))); - } - parent::setNativeValue($value); - } - - // }}} - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Array with the given nativeValue - * - * @param mixed nativeValue - */ - public function __construct($nativeValue) - { - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - $result = ''; - foreach($this->getNativeValue() as $element) { - $result .= ''; - $result .= ($element instanceof XML_RPC2_Backend_Php_Value) ? - $element->encode() : - XML_RPC2_Backend_Php_Value::createFromNative($element)->encode(); - $result .= ''; - } - $result .= ''; - return $result; - } - - // }}} - // {{{ decode() - - /** - * Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $values = $xml->xpath('/value/array/data/value'); - $result = array(); - foreach (array_keys($values) as $i) { - $result[] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i])->getNativeValue(); - } - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Base64.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Base64.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Base64.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Base64.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC base64 value class. Instances of this class represent base64-encoded string scalars in XML_RPC - * - * To work on a compatible way with the xmlrpcext backend, we introduce a particular "nativeValue" which is - * a standard class (stdclass) with two public properties : - * scalar => the string (non encoded) - * xmlrpc_type => 'base64' - * - * The constructor can be called with a "classic" string or with a such object - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Base64 extends XML_RPC2_Backend_Php_Value -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Base64 with the given value - * - * This class handles encoding-decoding internally. Do not provide the - * native string base64-encoded - * - * @param mixed String $nativeValue to be transmited base64-encoded or "stdclass native value" - */ - public function __construct($nativeValue) - { - if ((is_object($nativeValue)) &&(strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { - $scalar = $nativeValue->scalar; - } else { - if (!is_string($nativeValue)) { - throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Base64 from type \'%s\'.', gettype($nativeValue))); - } - $scalar = $nativeValue; - } - $tmp = new stdclass(); - $tmp->scalar = $scalar; - $tmp->xmlrpc_type = 'base64'; - $this->setNativeValue($tmp); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - $native = $this->getNativeValue(); - return '' . base64_encode($native->scalar) . ''; - } - - // }}} - // {{{ decode() - - /** - * Decode transport XML and set the instance value accordingly - * - * @param mixed $xml The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/base64/text()'); - if (!array_key_exists(0, $value)) { - $value = $xml->xpath('/value/text()'); - } - // Emulate xmlrpcext results (to be able to switch from a backend to another) - $result = new stdclass(); - $result->scalar = base64_decode($value[0]); - $result->xmlrpc_type = 'base64'; - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Boolean.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Boolean.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Boolean.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Boolean.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC boolean value class. Instances of this class represent boolean scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Boolean extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Value_Boolean with the given value - * - * @param mixed value - */ - public function __construct($nativeValue) - { - parent::__construct('boolean', $nativeValue); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - return '' . ($this->getNativeValue() ? 1 : 0). ''; - } - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/boolean/text()'); - - // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 - return (boolean) ((string) $value[0]); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Datetime.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Datetime.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Datetime.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Datetime.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,209 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC datetime value class. Instances of this class represent datetime scalars in XML_RPC - * - * To work on a compatible way with the xmlrpcext backend, we introduce a particular "nativeValue" which is - * a standard class (stdclass) with three public properties : - * scalar => the iso8601 date string - * timestamp => the corresponding timestamp (int) - * xmlrpc_type => 'datetime' - * - * The constructor can be called with a iso8601 string, with a timestamp or with a such object - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Datetime extends XML_RPC2_Backend_Php_Value -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Datetime with the given value - * - * The provided value can be an int, which will be interpreted as a Unix timestamp, or - * a string in iso8601 format, or a "stdclass native value" - * - * @param mixed $nativeValue a timestamp, an iso8601 date or a "stdclass native value" - * @see http://www.w3.org/TR/NOTE-datetime - */ - public function __construct($nativeValue) - { - if ((!is_int($nativeValue)) and (!is_float($nativeValue)) and (!is_string($nativeValue)) and (!is_object($nativeValue))) { - throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Datetime from type \'%s\'.', gettype($nativeValue))); - } - if ((is_object($nativeValue)) &&(strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { - $scalar = $nativeValue->scalar; - $timestamp = $nativeValue->timestamp; - } else { - if ((is_int($nativeValue)) or (is_float($nativeValue))) { - $scalar = XML_RPC2_Backend_Php_Value_Datetime::_timestampToIso8601($nativeValue); - $timestamp = (int) $nativeValue; - } elseif (is_string($nativeValue)) { - $scalar= $nativeValue; - $timestamp = (int) XML_RPC2_Backend_Php_Value_Datetime::_iso8601ToTimestamp($nativeValue); - } else { - throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Datetime from type \'%s\'.', gettype($nativeValue))); - } - } - $tmp = new stdclass(); - $tmp->scalar = $scalar; - $tmp->timestamp = $timestamp; - $tmp->xmlrpc_type = 'datetime'; - $this->setNativeValue($tmp); - } - - // }}} - // {{{ _iso8601ToTimestamp() - - /** - * Convert a iso8601 datetime string into timestamp - * - * @param string $datetime iso8601 datetime - * @return int corresponding timestamp - */ - private static function _iso8601ToTimestamp($datetime) - { - if (!preg_match('/([0-9]{4})(-?([0-9]{2})(-?([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?/', $datetime, $matches)) { - throw new XML_RPC2_InvalidDateFormatException(sprintf('Provided date \'%s\' is not ISO-8601.', $datetime)); - } - $year = $matches[1]; - $month = array_key_exists(3, $matches) ? $matches[3] : 1; - $day = array_key_exists(5, $matches) ? $matches[5] : 1; - $hour = array_key_exists(7, $matches) ? $matches[7] : 0; - $minutes = array_key_exists(8, $matches) ? $matches[8] : 0; - $seconds = array_key_exists(10, $matches) ? $matches[10] : 0; - $milliseconds = array_key_exists(12, $matches) ? ((double) ('0.' . $matches[12])) : 0; - if (array_key_exists(13, $matches)) { - if ($matches[13] == 'Z') { - $tzSeconds = 0; - } else { - $tmp = ($matches[15] == '-') ? -1 : 1; - $tzSeconds = $tmp * (((int) $matches[16]) * 3600 + ((int) $matches[17]) * 60); - } - } else { - $tzSeconds = 0; - } - if (class_exists('DateTime')) { - $result = new DateTime(); - $result->setDate($year, $month, $day); - $result->setTime($hour, $minutes, $seconds); - $result = $result->getTimestamp(); - if ($milliseconds==0) return $result; - return ((float) $result) + $milliseconds/1000; - } else { - $result = ((double) @mktime($hour, $minutes, $seconds, $month, $day, $year, 0)) + - ((double) $milliseconds) - - ((double) $tzSeconds); - if ($milliseconds==0) return ((int) $result); - return $result; - } - } - - // }}} - // {{{ _timestampToIso8601() - - /** - * Convert a timestamp into an iso8601 datetime - * - * @param int $timestamp timestamp - * @return string iso8601 datetim - */ - private static function _timestampToIso8601($timestamp) - { - return strftime('%Y%m%dT%H:%M:%S', (int) $timestamp); - } - - // }}} - // {{{ decode() - - /** - * Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/dateTime.iso8601/text()'); - if (!array_key_exists(0, $value)) { - $value = $xml->xpath('/value/text()'); - } - // Emulate xmlrpcext results (to be able to switch from a backend to another) - $result = new stdclass(); - $result->scalar = (string) $value[0]; - $result->timestamp = (int) XML_RPC2_Backend_Php_Value_Datetime::_iso8601ToTimestamp((string) $value[0]); - $result->xmlrpc_type = 'datetime'; - return $result; - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - $native = $this->getNativeValue(); - return '' . $native->scalar . ''; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Double.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Double.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Double.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Double.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC double value class. Instances of this class represent int scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Double extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Double with the given value - * - * @param mixed value - */ - public function __construct($nativeValue) - { - $this->setScalarType('double'); - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/double/text()'); - - // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 - return (double) ((string) $value[0]); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer64.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer64.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer64.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer64.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Integer64.php 224219 2006-12-02 18:09:49Z sergiosgc $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC integer value class. Instances of this class represent int scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Integer64 extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Integer64 with the given value - * - * @param mixed value - */ - public function __construct($nativeValue) - { - if (PHP_INT_SIZE < 8) throw new XML_RPC2_ConfigException('i8 XML-RPC extension can only be used with 64 bit (or larger) architectures'); - $this->setScalarType('i8'); - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The decoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/i8/text()'); - - // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 - return (int) ((string) $value[0]); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Integer.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC integer value class. Instances of this class represent int scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Integer extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Integer with the given value - * - * @param mixed value - */ - public function __construct($nativeValue) - { - $this->setScalarType('int'); - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The decoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $value = $xml->xpath('/value/int/text()|/value/i4/text()'); - - // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 - return (int) ((string) $value[0]); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Nil.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Nil.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Nil.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Nil.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Nil.php 224219 2006-12-02 18:09:49Z sergiosgc $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC null value class. Instances of this class represent null scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Nil extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Nil with the given value - * - * @param mixed value - */ - public function __construct() - { - $this->setScalarType('nil'); - $this->setNativeValue(null); - } - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The decoded XML-RPC value, - */ - public static function decode($xml) - { - return null; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Scalar.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Scalar.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Scalar.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Scalar.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value.php'; -// }}} - -/** - * XML_RPC scalar value abstract class. All XML_RPC value classes representing scalar types inherit from XML_RPC2_Value_Scalar - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Backend_Php_Value_Scalar extends XML_RPC2_Backend_Php_Value -{ - - // {{{ properties - - /** - * scalar type - * - * @var string - */ - private $_scalarType = null; - - // }}} - // {{{ setScalarType() - - /** - * scalarType property setter - * - * @param mixed value The new scalarType - */ - protected function setScalarType($value) - { - switch ($value) { - case 'nil': - case 'int': - case 'i8': - case 'i4': - case 'boolean': - case 'string': - case 'double': - case 'dateTime.iso8601': - case 'base64': - $this->_scalarType = $value; - break; - default: - throw new XML_RPC2_InvalidTypeException(sprintf('Type \'%s\' is not an XML-RPC scalar type', $value)); - } - } - - // }}} - // {{{ getScalarType() - - /** - * scalarType property getter - * - * @return mixed The current scalarType - */ - public function getScalarType() - { - return $this->_scalarType; - } - - // }}} - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Value_Scalar with the given nativeValue - * - * @param mixed nativeValue - */ - public function __construct($scalarType, $nativeValue) - { - $this->setScalarType($scalarType); - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ createFromNative() - - /** - * Choose a XML_RPC2_Value subclass appropriate for the - * given value and create it. - * - * @param string The native value - * @param string Optinally, the scalar type to use - * @throws XML_RPC2_InvalidTypeEncodeException When native value's type is not a native type - * @return XML_RPC2_Value The newly created value - */ - public static function createFromNative($nativeValue, $explicitType = null) - { - if (is_null($explicitType)) { - switch (gettype($nativeValue)) { - case 'integer': - $explicitType = $nativeValue <= 2147483647 /* PHP_INT_MAX on 32 bit systems */ ? gettype($nativeValue) : 'Integer64'; - break; - case 'NULL': - $explicitType = 'Nil'; - break; - case 'boolean': - case 'double': - case 'string': - $explicitType = gettype($nativeValue); - break; - default: - throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Impossible to encode scalar value \'%s\' from type \'%s\'. Native type is not a scalar XML_RPC type (boolean, integer, double, string)', - (string) $nativeValue, - gettype($nativeValue))); - } - } - $explicitType = ucfirst(strtolower($explicitType)); - require_once(sprintf('XML/RPC2/Backend/Php/Value/%s.php', $explicitType)); - $explicitType = sprintf('XML_RPC2_Backend_Php_Value_%s', $explicitType); - return new $explicitType($nativeValue); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - return '<' . $this->getScalarType() . '>' . $this->getNativeValue() . 'getScalarType() . '>'; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/String.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/String.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/String.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/String.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; -// }}} - -/** - * XML_RPC string value class. Instances of this class represent string scalars in XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_String extends XML_RPC2_Backend_Php_Value_Scalar -{ - - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_String with the given value - * - * @param mixed value - */ - public function __construct($nativeValue) - { - $this->setScalarType('string'); - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - return '' . strtr($this->getNativeValue(),array('&' => '&', '<' => '<' , '>' => '>')) . ''; - } - - // }}} - // {{{ decode() - - /** - * Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - /* Stupid way of testing for the presence of string element. I don't know another one. - At least got rid of the xpath and consequent reparsing of the XML - */ - if ($xml->string->asXML() === FALSE) { - return (string) $xml; - } else { - return (string) $xml->string; - } - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Struct.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Struct.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Struct.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value/Struct.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend/Php/Value.php'; -// }}} - -/** - * XML_RPC struct value class. Represents values of type struct (associative struct) - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Php_Value_Struct extends XML_RPC2_Backend_Php_Value -{ - - // {{{ setNativeValue() - - /** - * nativeValue property setter - * - * @param mixed value the new nativeValue - */ - protected function setNativeValue($value) - { - if (!is_array($value)) { - throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Struct from type \'%s\'.', gettype($value))); - } - parent::setNativeValue($value); - } - - // }}} - // {{{ constructor - - /** - * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Scalar with the given nativeValue - * - * @param mixed nativeValue - */ - public function __construct($nativeValue) - { - $this->setNativeValue($nativeValue); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - public function encode() - { - $result = ''; - foreach($this->getNativeValue() as $name => $element) { - $result .= ''; - $result .= ''; - $result .= strtr($name, array('&' => '&', '<' => '<', '>' => '>')); - $result .= ''; - $result .= ''; - $result .= ($element instanceof XML_RPC2_Backend_Php_Value) ? - $element->encode() : - XML_RPC2_Backend_Php_Value::createFromNative($element)->encode(); - $result .= ''; - $result .= ''; - } - $result .= ''; - return $result; - } - - // }}} - // {{{ decode() - - /** - * Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - public static function decode($xml) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $xml = simplexml_load_string($xml->asXML()); - $values = $xml->xpath('/value/struct/member'); - $result = array(); - foreach (array_keys($values) as $i) { - $result[(string) $values[$i]->name] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i]->value)->getNativeValue(); - } - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Php/Value.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2005 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Value.php'; -// }}} - -/** - * XML_RPC value abstract class. All XML_RPC value classes inherit from XML_RPC2_Value - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2005 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Backend_Php_Value extends XML_RPC2_Value -{ - // {{{ properties - - /** - * native value - * - * @var mixed - */ - private $_nativeValue = null; - - // }}} - // {{{ getNativeValue() - - /** - * nativeValue property getter - * - * @return mixed The current nativeValue - */ - public function getNativeValue() - { - return $this->_nativeValue; - } - - // }}} - // {{{ setNativeValue() - - /** - * nativeValue setter - * - * @param mixed $value - */ - protected function setNativeValue($value) - { - $this->_nativeValue = $value; - } - - // }}} - // {{{ createFromNative() - - /** - * Choose a XML_RPC2_Value subclass appropriate for the - * given value and create it. - * - * This method tries to find the most adequate XML-RPC datatype to hold - * a given PHP native type. Note that distinguishing some datatypes may be - * difficult: - * - Timestamps are represented by PHP integers, so an XML_RPC2_Value_Datetime is never returned - * - Indexed arrays and associative arrays are the same native PHP type. In this case: - * a) The array's indexes start at 0 or 1 and increase monotonically with step 1, or - * b) they do not - * in the first case, an XML_RPC2_Value_Array is returned. In the second, a XML_RPC2_Value_Struct is returned. - * - PHP Objects are serialized and represented in an XML_RPC2_Value_Base64 - * - Integers fitting in a 32bit integer are encoded as regular xml-rpc integers - * - Integers larger than 32bit are encoded using the i8 xml-rpc extension - * - * Whenever native object automatic detection proves inaccurate, use XML_RPC2_Value::createFromNative providing - * a valid explicit type as second argument - * - * the appropriate XML_RPC2_Value child class instead. - * - * @param mixed The native value - * @param string The xml-rpc target encoding type, as per the xmlrpc spec (optional) - * @throws XML_RPC2_InvalidTypeEncodeException When the native value has a type that can't be translated to XML_RPC - * @return A new XML_RPC2_Value instance - * @see XML_RPC_Client::__call - * @see XML_RPC_Server - */ - public static function createFromNative($nativeValue, $explicitType = null) - { - if (is_null($explicitType)) { - switch (gettype($nativeValue)) { - case 'boolean': - $explicitType = 'boolean'; - break; - case 'integer': - $explicitType = 'int'; - break; - case 'double': - $explicitType = 'double'; - break; - case 'string': - $explicitType = 'string'; - break; - case 'array': - $explicitType = 'array'; - $keys = array_keys($nativeValue); - if (count($keys) > 0) { - if ($keys[0] !== 0 && ($keys[0] !== 1)) $explicitType = 'struct'; - $i=0; - do { - $previous = $keys[$i]; - $i++; - if (array_key_exists($i, $keys) && ($keys[$i] !== $keys[$i - 1] + 1)) $explicitType = 'struct'; - } while (array_key_exists($i, $keys) && $explicitType == 'array'); - } - break; - case 'object': - if ((strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { - // In this case, we have a "stdclass native value" (emulate xmlrpcext) - // the type 'base64' or 'datetime' is given by xmlrpc_type public property - $explicitType = $nativeValue->xmlrpc_type; - } else { - $nativeValue = serialize($nativeValue); - $explicitType = 'base64'; - } - break; - case 'resource': - case 'NULL': - case 'unknown type': - throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Impossible to encode value \'%s\' from type \'%s\'. No analogous type in XML_RPC.', - (string) $nativeValue, - gettype($nativeValue))); - default: - throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Unexpected PHP native type returned by gettype: \'%s\', for value \'%s\'', - gettype($nativeValue), - (string) $nativeValue)); - } - } - $explicitType = ucfirst(strtolower($explicitType)); - switch ($explicitType) { - case 'I8': - require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; - return XML_RPC2_Backend_Php_Value_Scalar::createFromNative($nativeValue, 'Integer64'); - break; - case 'I4': - case 'Int': - case 'Boolean': - case 'Double': - case 'String': - case 'Nil': - require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; - return XML_RPC2_Backend_Php_Value_Scalar::createFromNative($nativeValue); - break; - case 'Datetime.iso8601': - case 'Datetime': - require_once 'XML/RPC2/Backend/Php/Value/Datetime.php'; - return new XML_RPC2_Backend_Php_Value_Datetime($nativeValue); - break; - case 'Base64': - require_once 'XML/RPC2/Backend/Php/Value/Base64.php'; - return new XML_RPC2_Backend_Php_Value_Base64($nativeValue); - break; - case 'Array': - require_once 'XML/RPC2/Backend/Php/Value/Array.php'; - return new XML_RPC2_Backend_Php_Value_Array($nativeValue); - break; - case 'Struct': - require_once 'XML/RPC2/Backend/Php/Value/Struct.php'; - return new XML_RPC2_Backend_Php_Value_Struct($nativeValue); - break; - default: - throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Unexpected explicit encoding type \'%s\'', $explicitType)); - } - } - - // }}} - // {{{ createFromDecode() - - /** - * Decode an encoded value and build the applicable XML_RPC2_Value subclass - * - * @param SimpleXMLElement The encoded XML-RPC value - * @return mixed the corresponding XML_RPC2_Value object - */ - public static function createFromDecode($simpleXML) - { - // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when - // xpath is used both in an element and in one of its children - $simpleXML = simplexml_load_string($simpleXML->asXML()); - - $valueType = $simpleXML->xpath('./*'); - if (count($valueType) == 1) { // Usually we must check the node name - $nodename = dom_import_simplexml($valueType[0])->nodeName; - switch ($nodename) { - case 'i8': - $nativeType = 'Integer64'; - break; - case 'i4': - case 'int': - $nativeType = 'Integer'; - break; - case 'boolean': - $nativeType = 'Boolean'; - break; - case 'double': - $nativeType = 'Double'; - break; - case 'string': - $nativeType = 'String'; - break; - case 'dateTime.iso8601': - $nativeType = 'Datetime'; - break; - case 'base64': - $nativeType = 'Base64'; - break; - case 'array': - $nativeType = 'Array'; - break; - case 'struct': - $nativeType = 'Struct'; - break; - case 'nil': - $nativeType = 'Nil'; - break; - default: - throw new XML_RPC2_DecodeException(sprintf('Unable to decode XML-RPC value. Value type is not recognized \'%s\'', $nodename)); - } - } elseif (count($valueType) == 0) { // Default type is string - $nodename = null; - $nativeType = 'String'; - } else { - throw new XML_RPC2_DecodeException(sprintf('Unable to decode XML-RPC value. Value presented %s type nodes: %s.', count($valueType), $simpleXML->asXML())); - } - require_once(sprintf('XML/RPC2/Backend/Php/Value/%s.php', $nativeType)); - $nativeType = 'XML_RPC2_Backend_Php_Value_' . $nativeType; - return self::createFromNative(@call_user_func(array($nativeType, 'decode'), $simpleXML), $nodename); - } - - // }}} - // {{{ encode() - - /** - * Encode the instance into XML, for transport - * - * @return string The encoded XML-RPC value, - */ - // Declaration commented because of: http://pear.php.net/bugs/bug.php?id=8499 -// public abstract function encode(); - - // }}} - // {{{ decode() - - /** - * decode. Decode transport XML and set the instance value accordingly - * - * @param mixed The encoded XML-RPC value, - */ - // Declaration commented because of: http://pear.php.net/bugs/bug.php?id=8499 -// public static abstract function decode($xml); - - // }}} -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Client.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Client.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Client.php'; -require_once 'XML/RPC2/Util/HTTPRequest.php'; -//}}} - -/** - * XML_RPC client backend class. This backend class uses the XMLRPCext extension to execute the call. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Xmlrpcext_Client extends XML_RPC2_Client -{ - - // {{{ constructor - - /** - * Construct a new XML_RPC2_Client PHP Backend. - * - * A URI must be provided (e.g. http://xmlrpc.example.com/1.0/). - * Optionally, some options may be set. - * - * @param string URI for the XML-RPC server - * @param array (optional) Associative array of options - */ - public function __construct($uri, $options = array()) - { - parent::__construct($uri, $options); - } - - // }}} - // {{{ __call() - - /** - * __call Catchall. This method catches remote method calls and provides for remote forwarding. - * - * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to - * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value - * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative - * proves inacurate -- as when encoding DateTime values -- you should present an instance of - * XML_RPC_Value in lieu of the native parameter. - * - * @param string Method name - * @param array Parameters - * @return mixed The call result, already decoded into native types - */ - public function __call($methodName, $parameters) - { - $tmp = xmlrpc_encode_request($this->prefix . $methodName, $parameters, array('escaping' => $this->escaping, 'encoding' => $this->encoding)); - if ($this->uglyStructHack) { - // ugly hack because of http://bugs.php.net/bug.php?id=21949 - // see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos - $request = preg_replace('~xml_rpc2_ugly_struct_hack_(.*)~', '\1', $tmp); - } else { - $request = $tmp; - } - $uri = $this->uri; - $options = array( - 'encoding' => $this->encoding, - 'proxy' => $this->proxy, - 'sslverify' => $this->sslverify, - 'connectionTimeout' => $this->connectionTimeout - ); - if (isset($this->httpRequest)) $options['httpRequest'] = $this->httpRequest; - $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options); - $httpRequest->setPostData($request); - $httpRequest->sendRequest(); - $body = $httpRequest->getBody(); - if ($this->debug) { - XML_RPC2_ClientHelper::printPreParseDebugInfo($request, $body); - } - $result = xmlrpc_decode($body, $this->encoding); - /* Commented due to change in behaviour from xmlrpc_decode. It does not return faults now - if ($result === false || is_null($result)) { - if ($this->debug) { - print "XML_RPC2_Exception : unable to decode response !"; - } - throw new XML_RPC2_Exception('Unable to decode response'); - } - */ - if (is_array($result) && xmlrpc_is_fault($result)) { - if ($this->debug) { - print "XML_RPC2_FaultException(${result['faultString']}, ${result['faultCode']})"; - } - throw new XML_RPC2_FaultException($result['faultString'], $result['faultCode']); - } - if ($this->debug) { - XML_RPC2_ClientHelper::printPostRequestDebugInformation($result); - } - return $result; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Server.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Server.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Backend/Php/Request.php'; -require_once 'XML/RPC2/Backend/Php/Response.php'; -require_once 'XML/RPC2/Exception.php'; -// }}} - -/** - * XML_RPC server class XMLRPCext extension-based backend - * - * The XML_RPC2_Server does the work of decoding and encoding xml-rpc request and response. The actual - * method execution is delegated to the call handler instance. - * - * The XML_RPC server is responsible for decoding the request and calling the appropriate method in the - * call handler class. It then encodes the result into an XML-RPC response and returns it to the client. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Xmlrpcext_Server extends XML_RPC2_Server -{ - // {{{ properties - - /** - * xmlrpcext server - * - * @var resource - */ - private $_xmlrpcextServer; - - // }}} - // {{{ constructor - - /** - * Create a new XML-RPC Server. - * - * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual - * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client - * - * @param object $callHandler - * @param array $options associative array of options - */ - function __construct($callHandler, $options = array()) - { - parent::__construct($callHandler, $options); - $this->_xmlrpcextServer = xmlrpc_server_create(); - foreach ($callHandler->getMethods() as $method) { - if (xmlrpc_server_register_method($this->_xmlrpcextServer, - $method->getName(), - array($this, 'epiFunctionHandlerAdapter')) !== true) { - throw new XML_RPC2_Exception('Unable to setup XMLRPCext server. xmlrpc_server_register_method returned non-true.'); - } - } - } - - // }}} - // {{{ epiFunctionHandlerAdapter() - - /** - * This is an adapter between XML_RPC2_CallHandler::__call and xmlrpc_server_register_method callback interface - * - * @param string Method name - * @param array Parameters - * @param array Application data (ignored) - */ - protected function epiFunctionHandlerAdapter($method_name, $params, $app_data) { - return @call_user_func_array(array($this->callHandler, $method_name), $params); - } - - // }}} - // {{{ handleCall() - - /** - * Respond to the XML-RPC request. - * - * handleCall reads the XML-RPC request from the raw HTTP body and decodes it. It then calls the - * corresponding method in the call handler class, returning the encoded result to the client. - */ - public function handleCall() - { - if ($this->autoDocument && $this->input->isEmpty()) { - $this->autoDocument(); - } else { - $response = $this->getResponse(); - header('Content-type: text/xml; charset=' . $this->encoding); - header('Content-length: ' . $this->getContentLength($response)); - print $response; - } - } - - // }}} - // {{{ getResponse() - - /** - * get the XML response of the XMLRPC server - * - * @return string the XML response - */ - public function getResponse() - { - try { - if ($this->signatureChecking) { - $tmp = xmlrpc_parse_method_descriptions($this->input->readRequest()); - $methodName = $tmp['methodName']; - $parameters = xmlrpc_decode($this->input->readRequest(), $this->encoding); - $method = $this->callHandler->getMethod($methodName); - if (!($method)) { - // see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes - return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found')); - } - if (!($method->matchesSignature($methodName, $parameters))) { - return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters')); - } - } - set_error_handler(array('XML_RPC2_Backend_Xmlrpcext_Server', 'errorToException')); - $response = @xmlrpc_server_call_method($this->_xmlrpcextServer, - $this->input->readRequest(), - null, - array('output_type' => 'xml', 'encoding' => $this->encoding)); - restore_error_handler(); - return $response; - } catch (XML_RPC2_FaultException $e) { - return (XML_RPC2_Backend_Php_Response::encodeFault($e->getFaultCode(), $e->getMessage())); - } catch (Exception $e) { - if (ini_get('display_errors') == 1) { - return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage())); - } else { - return XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled PHP Exception'); - } - } - } - // }}} -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Value.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend/Xmlrpcext/Value.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend.php'; -// }}} - -/** - * XML_RPC value class for the XMLRPCext backend. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Backend_Xmlrpcext_Value -{ - - // {{{ createFromNative() - - /** - * Factory method that constructs the appropriate XML-RPC encoded type value - * - * @param mixed Value to be encode - * @param string Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type) - * @return mixed The encoded value - */ - public static function createFromNative($value, $explicitType) - { - $type = strtolower($explicitType); - $availableTypes = array('datetime', 'base64', 'struct'); - if (in_array($type, $availableTypes)) { - if ($type=='struct') { - if (!(is_array($value))) { - throw new XML_RPC2_Exception('With struct type, value has to be an array'); - } - // Because of http://bugs.php.net/bug.php?id=21949 - // is some cases (structs with numeric indexes), we need to be able to force the "struct" type - // (xmlrpc_set_type doesn't help for this, so we need this ugly hack) - $new = array(); - while (list($k, $v) = each($value)) { - $new["xml_rpc2_ugly_struct_hack_$k"] = $v; - // with this "string" prefix, we are sure that the array will be seen as a "struct" - } - return $new; - } - $value2 = (string) $value; - if (!xmlrpc_set_type($value2, $type)) { - throw new XML_RPC2_Exception('Error returned from xmlrpc_set_type'); - } - return $value2; - } - return $value; - } - - // }}} - -} - -?> \ No newline at end of file diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Backend.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Backend.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,191 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'PEAR.php'; -// }}} - -/** - * XML_RPC Backend class. The backend is responsible for the actual execution of - * a request, as well as payload encoding and decoding. - * - * The only external usage of this class is when explicitely setting the backend, as in - * - * XML_RPC2_Backend::setBackend('php'); - * // or - * XML_RPC2_Backend::setBackend('xmlrpcext'); - * - * Note that if you do not explicitely set the backend, it will be selected automatically. - * - * Internally, this class provides methods to obtain the relevant backend classes: - * - The server class - * - The client class - * - The value class - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Backend -{ - - // {{{ properties - - /** - * current backend - * - * @var string - */ - protected static $currentBackend; - - // }}} - // {{{ setBackend() - - /** - * Backend setter. - * - * Currently, two backends exist: 'php' and 'XMLRPCext'. - * The PHP backend has no external dependencies, while the xmlrpcext - * requires the xmlrpc extension. - * - * The XMLRPCext backend is quite faster, and will be automatically - * selected when no explicit backend has been set and the extension - * is available. - * - * @param string The backend to select. Either 'php' or 'XMLRPCext'. - */ - public static function setBackend($backend) - { - $backend = ucfirst(strtolower($backend)); - if ( - $backend != 'Php' && - $backend != 'Xmlrpcext' - ) { - throw new XML_RPC2_Exception(sprintf('Backend %s does not exist', $backend)); - } - if ( - $backend == 'Xmlrpcext' && - !function_exists('xmlrpc_server_create') && - !( PEAR::loadExtension('php_xmlrpc') ) - ) { - throw new XML_RPC2_Exception('Unable to load xmlrpc extension.'); - } - self::$currentBackend = $backend; - } - - // }}} - // {{{ getBackend() - - /** - * Backend getter. - * - * Return the current backend name. If no backend was previously selected - * select one and set it. - * - * The xmlrpcext backend is preferred, and will be automatically - * selected when no explicit backend has been set and the xmlrpc - * extension exists. If it does not exist, then the php backend is - * selected. - * - * @return string The current backend - */ - protected static function getBackend() - { - if (!isset(self::$currentBackend)) { - try { - self::setBackend('XMLRPCext'); // We prefer this one - } catch (XML_RPC2_Exception $e) { - // TODO According to PEAR CG logging should occur here - self::setBackend('php'); // But will settle with this one in case of error - } - } - return self::$currentBackend; - } - - // }}} - // {{{ getServerClassname() - - /** - * Include the relevant php files for the server class, and return the backend server - * class name. - * - * @return string The Server class name - */ - public static function getServerClassname() { - require_once(sprintf('XML/RPC2/Backend/%s/Server.php', self::getBackend())); - return sprintf('XML_RPC2_Backend_%s_Server', self::getBackend()); - } - - // }}} - // {{{ getClientClassname() - - /** - * Include the relevant php files for the client class, and return the backend client - * class name. - * - * @return string The Client class name - */ - public static function getClientClassname() { - require_once(sprintf('XML/RPC2/Backend/%s/Client.php', self::getBackend())); - return sprintf('XML_RPC2_Backend_%s_Client', self::getBackend()); - } - - // }}} - // {{{ getValueClassname() - - /** - * Include the relevant php files for the value class, and return the backend value - * class name. - * - * @return string The Value class name - */ - public static function getValueClassname() { - require_once(sprintf('XML/RPC2/Backend/%s/Value.php', self::getBackend())); - return sprintf('XML_RPC2_Backend_%s_Value', self::getBackend()); - } - - // }}} - -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/CachedClient.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/CachedClient.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/CachedClient.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/CachedClient.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,361 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Fabien MARTY -* @copyright 2005-2006 Fabien MARTY -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once('Cache/Lite.php'); -require_once('XML/RPC2/Exception.php'); -// }}} - -/** - * XML_RPC "cached client" class. - * - * @category XML - * @package XML_RPC2 - * @author Fabien MARTY - * @copyright 2005-2006 Fabien MARTY - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_CachedClient { - - // {{{ properties - - /** - * Associative array of options for XML_RPC2_Client - * - * @var array - */ - private $_options; - - /** - * uri Field (holds the uri for the XML_RPC server) - * - * @var array - */ - private $_uri; - - /** - * Holds the debug flag - * - * @var boolean - */ - private $_debug = false; - - /** - * Cache_Lite options array - * - * @var array - */ - private $_cacheOptions = array(); - - /** - * Cached methods array (usefull only if cache is off by default) - * - * example1 : array('method1ToCache', 'method2ToCache', ...) - * example2 (with specific cache lifetime) : - * array('method1ToCache' => 3600, 'method2ToCache' => 60, ...) - * NB : a lifetime value of -1 means "no cache for this method" - * - * @var array - */ - private $_cachedMethods = array(); - - /** - * Non-Cached methods array (usefull only if cache is on by default) - * - * example : array('method1ToCache', 'method2ToCache', ...) - * - * @var array - */ - private $_notCachedMethods = array(); - - /** - * cache by default - * - * @var boolean - */ - private $_cacheByDefault = true; - - /** - * Cache_Lite object - * - * @var object - */ - private $_cacheObject = null; - - /** - * XML_RPC2_Client object (if needed, dynamically built) - * - * @var object - */ - private $_clientObject = null; - - /** - * Default cache group for XML_RPC client caching - * - * @var string - */ - private $_defaultCacheGroup = 'xml_rpc2_client'; - - /** - * "cache debug" flag (for debugging the caching process) - * - * @var boolean - */ - private $_cacheDebug = false; - - // }}} - // {{{ constructor - - /** - * Constructor - * - * TODO : documentations about cache options - * - * @param string URI for the XML-RPC server - * @param array (optional) Associative array of options - */ - protected function __construct($uri, $options = array()) - { - if (isset($options['cacheOptions'])) { - $array = $options['cacheOptions']; - if (isset($array['defaultCacheGroup'])) { - $this->_defaultCacheGroup = $array['defaultCacheGroup']; - unset($array['defaultCacheGroup']); // this is a "non standard" option for Cache_Lite - } - if (isset($array['cachedMethods'])) { - $this->_cachedMethods = $array['cachedMethods']; - unset($array['cachedMethods']); // this is a "non standard" option for Cache_Lite - } - if (isset($array['notCachedMethods'])) { - $this->_notCachedMethods = $array['notCachedMethods']; - unset($array['notCachedMethods']); // this is a "non standard" option for Cache_Lite - } - if (isset($array['cacheByDefault'])) { - $this->_cacheByDefault = $array['cacheByDefault']; - unset($array['CacheByDefault']); // this is a "non standard" option for Cache_Lite - } - $array['automaticSerialization'] = false; // datas are already serialized in this class - if (!isset($array['lifetime'])) { - $array['lifetime'] = 3600; // we need a default lifetime - } - unset($options['cacheOptions']); // this is a "non standard" option for XML/RPC2/Client - } else { // no cache options ? - $array = array( - 'lifetime' => 3600, // we need a default lifetime - 'automaticSerialization' => false // datas are already serialized in this class - ); - } - if (isset($options['cacheDebug'])) { - $this->_cacheDebug = $options['cacheDebug']; - unset($options['cacheDebug']); // this a "non standard" option for XML/RPC2/Client - } - $this->_cacheOptions = $array; - $this->_cacheObject = new Cache_Lite($this->_cacheOptions); - $this->_options = $options; - $this->_uri = $uri; - } - - // }}} - // {{{ create() - - /** - * "Emulated Factory" method to get the same API than XML_RPC2_Client class - * - * Here, simply returns a new instance of XML_RPC2_CachedClient class - * - * @param string URI for the XML-RPC server - * @param string (optional) Prefix to prepend on all called functions (defaults to '') - * @param string (optional) Proxy server URI (defaults to no proxy) - * - */ - public static function create($uri, $options = array()) - { - return new XML_RPC2_CachedClient($uri, $options); - } - - // }}} - // {{{ __call() - - /** - * __call Catchall - * - * Encapsulate all the class logic : - * - determine if the cache has to be used (or not) for the called method - * - see if a cache is available for this call - * - if no cache available, really do the call and store the result for next time - * - * @param string Method name - * @param array Parameters - * @return mixed The call result, already decoded into native types - */ - public function __call($methodName, $parameters) - { - if (!isset($this->_cacheObject)) { - $this->_cacheObject = new Cache_Lite($this->_cacheOptions); - } - if (in_array($methodName, $this->_notCachedMethods)) { - // if the called method is listed in _notCachedMethods => no cache - if ($this->_cacheDebug) { - print "CACHE DEBUG : the called method is listed in _notCachedMethods => no cache !\n"; - } - return $this->_workWithoutCache___($methodName, $parameters); - } - if (!($this->_cacheByDefault)) { - if ((!(isset($this->_cachedMethods[$methodName]))) and (!(in_array($methodName, $this->_cachedMethods)))) { - // if cache is not on by default and if the called method is not described in _cachedMethods array - // => no cache - if ($this->_cacheDebug) { - print "CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache !\n"; - } - return $this->_workWithoutCache___($methodName, $parameters); - } - } - if (isset($this->_cachedMethods[$methodName])) { - if ($this->_cachedMethods[$methodName] == -1) { - // if a method is described with a lifetime value of -1 => no cache - if ($this->_cacheDebug) { - print "CACHE DEBUG : called method has a -1 lifetime value => no cache !\n"; - } - return $this->_workWithoutCache___($methodName, $parameters); - } - // if a method is described with a specific (and <> -1) lifetime - // => we fix this new lifetime - $this->_cacheObject->setLifetime($this->_cachedMethods[$methodName]); - } else { - // there is no specific lifetime, let's use the default one - $this->_cacheObject->setLifetime($this->_cacheOptions['lifetime']); - } - $cacheId = $this->_makeCacheId___($methodName, $parameters); - $data = $this->_cacheObject->get($cacheId, $this->_defaultCacheGroup); - if (is_string($data)) { - // cache is hit ! - if ($this->_cacheDebug) { - print "CACHE DEBUG : cache is hit !\n"; - } - return unserialize($data); - } - // the cache is not hit, let's call the "real" XML_RPC client - if ($this->_cacheDebug) { - print "CACHE DEBUG : cache is not hit !\n"; - } - $result = $this->_workWithoutCache___($methodName, $parameters); - $this->_cacheObject->save(serialize($result)); // save in cache for next time... - return $result; - } - - // }}} - // {{{ _workWithoutCache___() - - /** - * Do the real call if no cache available - * - * NB : The '___' at the end of the method name is to avoid collisions with - * XMLRPC __call() - * - * @param string Method name - * @param array Parameters - * @return mixed The call result, already decoded into native types - */ - private function _workWithoutCache___($methodName, $parameters) - { - if (!(isset($this->_clientObject))) { - // If the XML_RPC2_Client object is not available, let's build it - require_once('XML/RPC2/Client.php'); - $this->_clientObject = XML_RPC2_Client::create($this->_uri, $this->_options); - } - // the real function call... - return call_user_func_array(array($this->_clientObject, $methodName), $parameters); - } - - // }}} - // {{{ _makeCacheId___() - - /** - * make a cache id depending on method called (and corresponding parameters) but depending on "environnement" setting too - * - * NB : The '___' at the end of the method name is to avoid collisions with - * XMLRPC __call() - * - * @param string $methodName called method - * @param array $parameters parameters of the called method - * @return string cache id - */ - private function _makeCacheId___($methodName, $parameters) - { - return md5($methodName . serialize($parameters) . serialize($this->_uri) . serialize($this->_options)); - } - - // }}} - // {{{ dropCacheFile___() - - /** - * Drop the cache file corresponding to the given method call - * - * NB : The '___' at the end of the method name is to avoid collisions with - * XMLRPC __call() - * - * @param string $methodName called method - * @param array $parameters parameters of the called method - */ - public function dropCacheFile___($methodName, $parameters) - { - $id = $this->_makeCacheId___($methodName, $parameters); - $this->_cacheObject->remove($id, $this->_defaultCacheGroup); - } - - // }}} - // {{{ clean___() - - /** - * Clean all the cache - * - * NB : The '___' at the end of the method name is to avoid collisions with - * XMLRPC __call() - */ - public function clean___() - { - $this->_cacheObject->clean($this->_defaultCacheGroup, 'ingroup'); - } - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/CachedServer.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/CachedServer.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/CachedServer.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/CachedServer.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,416 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Fabien MARTY -* @copyright 2005-2006 Fabien MARTY -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once('Cache/Lite.php'); -// }}} - -/** - * XML_RPC "cached server" class. - * - * @category XML - * @package XML_RPC2 - * @author Fabien MARTY - * @copyright 2005-2006 Fabien MARTY - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_CachedServer { - - // {{{ properties - - /** - * cache by default - * - * @var boolean - */ - private $_cacheByDefault = true; - - /** - * Cache_Lite object - * - * @var object - */ - private $_cacheObject = null; - - /** - * XML_RPC2_Server object (if needed, dynamically built) - * - * @var object - */ - private $_serverObject = null; - - /** - * Default cache group for XML_RPC server caching - * - * @var string - */ - private $_defaultCacheGroup = 'xml_rpc2_server'; - - /** - * callHandler field - * - * The call handler is responsible for executing the server exported methods - * - * @var mixed - */ - private $_callHandler = null; - - /** - * either a class name or an object instance - * - * @var mixed - */ - private $_callTarget = ''; - - /** - * methods prefix - * - * @var string - */ - private $_prefix = ''; - - /** - * XML_RPC2_Server options - * - * @var array - */ - private $_options = array(); - - /** - * "cache debug" flag (for debugging the caching process) - * - * @var boolean - */ - private $_cacheDebug = false; - - /** - * encoding - * - * @var string - */ - private $_encoding = 'utf-8'; - - // }}} - // {{{ setCacheOptions() - - /** - * Set options for the caching process - * - * See Cache_Lite constructor for options - * Specific options are 'cachedMethods', 'notCachedMethods', 'cacheByDefault', 'defaultCacheGroup' - * See corresponding properties for more informations - * - * @param array $array - */ - private function _setCacheOptions($array) - { - if (isset($array['defaultCacheGroup'])) { - $this->_defaultCacheGroup = $array['defaultCacheGroup']; - unset($array['defaultCacheGroup']); // this is a "non standard" option for Cache_Lite - } - if (isset($array['cacheByDefault'])) { - $this->_cacheByDefault = $array['cacheByDefault']; - unset($array['CacheByDefault']); // this is a "non standard" option for Cache_Lite - } - $array['automaticSerialization'] = false; // datas are already serialized in this class - if (!isset($array['lifetime'])) { - $array['lifetime'] = 3600; // we need a default lifetime - } - $this->_cacheOptions = $array; - $this->_cacheObject = new Cache_Lite($this->_cacheOptions); - } - - // }}} - // {{{ constructor - - /** - * Constructor - * - * @param object $callHandler the call handler will receive a method call for each remote call received. - */ - protected function __construct($callTarget, $options = array()) - { - if (isset($options['cacheOptions'])) { - $cacheOptions = $options['cacheOptions']; - $this->_setCacheOptions($cacheOptions); - unset($options['cacheOptions']); - } - if (isset($options['cacheDebug'])) { - $this->_cacheDebug = $options['cacheDebug']; - unset($options['cacheDebug']); // 'cacheDebug' is not a standard option for XML/RPC2/Server - } - $this->_options = $options; - $this->_callTarget = $callTarget; - if (isset($this->_options['encoding'])) { - $this->_encoding = $this->_options['encoding']; - } - if (isset($this->_options['prefix'])) { - $this->_prefix = $this->_options['prefix']; - } - } - - // }}} - // {{{ create() - - /** - * "Emulated Factory" method to get the same API than XML_RPC2_Server class - * - * Here, simply returns a new instance of XML_RPC2_CachedServer class - * - * @param mixed $callTarget either a class name or an object instance. - * @param array $options associative array of options - * @return object a server class instance - */ - public static function create($callTarget, $options = array()) - { - return new XML_RPC2_CachedServer($callTarget, $options); - } - - // }}} - // {{{ handleCall() - - /** - * handle XML_RPC calls - * - */ - public function handleCall() - { - $response = $this->getResponse(); - $encoding = 'utf-8'; - if (isset($this->_options['encoding'])) { - $encoding = $this->_options['encoding']; - } - header('Content-type: text/xml; charset=' . $encoding); - header('Content-length: ' . $this->getContentLength($response)); - print $response; - } - - /** - * get the XML response of the XMLRPC server - * - * @return string the XML response - */ - public function getResponse() - { - if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $methodName = $this->_parseMethodName($GLOBALS['HTTP_RAW_POST_DATA']); - } else { - $methodName = null; - } - $weCache = $this->_cacheByDefault; - $lifetime = $this->_cacheOptions['lifetime']; - if ($this->_cacheDebug) { - if ($weCache) { - print "CACHE DEBUG : default values => weCache=true, lifetime=$lifetime\n"; - } else { - print "CACHE DEBUG : default values => weCache=false, lifetime=$lifetime\n"; - } - } - if ($methodName) { - // work on reflection API to search for @xmlrpc.caching tags into PHPDOC comments - list($weCache, $lifetime) = $this->_reflectionWork($methodName); - if ($this->_cacheDebug) { - if ($weCache) { - print "CACHE DEBUG : phpdoc comments => weCache=true, lifetime=$lifetime\n"; - } else { - print "CACHE DEBUG : phpdoc comments => weCache=false, lifetime=$lifetime\n"; - } - } - } - if (($weCache) and ($lifetime!=-1)) { - if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $cacheId = $this->_makeCacheId($GLOBALS['HTTP_RAW_POST_DATA']); - } else { - $cacheId = 'norawpostdata'; - } - $this->_cacheObject = new Cache_Lite($this->_cacheOptions); - $this->_cacheObject->setLifetime($lifetime); - if ($data = $this->_cacheObject->get($cacheId, $this->_defaultCacheGroup)) { - // cache id hit - if ($this->_cacheDebug) { - print "CACHE DEBUG : cache is hit !\n"; - } - } else { - // cache is not hit - if ($this->_cacheDebug) { - print "CACHE DEBUG : cache is not hit !\n"; - } - $data = $this->_workWithoutCache(); - $this->_cacheObject->save($data); - } - } else { - if ($this->_cacheDebug) { - print "CACHE DEBUG : we don't cache !\n"; - } - $data = $this->_workWithoutCache(); - } - return $data; - } - - // }}} - // {{{ _reflectionWork() - - /** - * Work on reflection API to search for @xmlrpc.caching tags into PHPDOC comments - * - * @param string $methodName method name - * @return array array((boolean) weCache, (int) lifetime) => parameters to use for caching - */ - private function _reflectionWork($methodName) { - $weCache = $this->_cacheByDefault; - $lifetime = $this->_cacheOptions['lifetime']; - if (is_string($this->_callTarget)) { - $className = strtolower($this->_callTarget); - } else { - $className = get_class($this->_callTarget); - } - $class = new ReflectionClass($className); - $method = $class->getMethod($methodName); - $docs = explode("\n", $method->getDocComment()); - foreach ($docs as $i => $doc) { - $doc = trim($doc, " \r\t/*"); - $res = preg_match('/@xmlrpc.caching ([+-]{0,1}[a-zA-Z0-9]*)/', $doc, $results); // TODO : better/faster regexp ? - if ($res>0) { - $value = $results[1]; - if (($value=='yes') or ($value=='true') or ($value=='on')) { - $weCache = true; - } else if (($value=='no') or ($value=='false') or ($value=='off')) { - $weCache = false; - } else { - $lifetime = (int) $value; - if ($lifetime==-1) { - $weCache = false; - } else { - $weCache = true; - } - } - } - } - return array($weCache, $lifetime); - } - - // }}} - // {{{ _parseMethodName() - - /** - * Parse the method name from the raw XMLRPC client request - * - * NB : the prefix is removed from the method name - * - * @param string $request raw XMLRPC client request - * @return string method name - */ - private function _parseMethodName($request) - { - // TODO : change for "simplexml" - $res = preg_match('/' . $this->_prefix . '([a-zA-Z0-9\.,\/]*)<\/methodName>/', $request, $results); - if ($res>0) { - return $results[1]; - } - return false; - } - - // }}} - // {{{ _workWithoutCache() - - /** - * Do the real stuff if no cache available - * - * @return string the response of the real XML/RPC2 server - */ - private function _workWithoutCache() - { - require_once('XML/RPC2/Server.php'); - $this->_serverObject = XML_RPC2_Server::create($this->_callTarget, $this->_options); - return $this->_serverObject->getResponse(); - } - - // }}} - // {{{ _makeCacheId() - - /** - * make a cache id depending on the raw xmlrpc client request but depending on "environnement" setting too - * - * @param string $raw_request - * @return string cache id - */ - private function _makeCacheId($raw_request) - { - return md5($raw_request . serialize($this->_options)); - } - - // }}} - // {{{ clean() - - /** - * Clean all the cache - */ - public function clean() - { - $this->_cacheObject->clean($this->_defaultCacheGroup, 'ingroup'); - } - - // }}} - // {{{ getContentLength() - - /** - * Gets the content legth of a serialized XML-RPC message in bytes - * - * @param string $content the serialized XML-RPC message. - * - * @return integer the content length in bytes. - */ - protected function getContentLength($content) - { - if (extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) == 2) { - $length = mb_strlen($content, '8bit'); - } else { - $length = strlen((binary)$content); - } - - return $length; - } - - // }}} -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/ClientHelper.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/ClientHelper.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/ClientHelper.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/ClientHelper.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Client.php 308640 2011-02-24 20:46:30Z sergiosgc $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend.php'; -// }}} - -/** - * XML_RPC2 client helper class. - * - * XML_RPC2_Client must maintain a function namespace as clean as possible. As such - * whenever possible, methods that may be usefull to subclasses but shouldn't be defined - * in XML_RPC2 because of namespace pollution are defined here. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_ClientHelper -{ - // {{{ printPreParseDebugInfo() - - /** - * Display debug informations - * - * @param string $request XML client request - * @param string $body XML server response - */ - public static function printPreParseDebugInfo($request, $body) - { - print '
';
-        print "***** Request *****\n";
-        print htmlspecialchars($request);
-        print "***** End Of request *****\n\n";
-        print "***** Server response *****\n";
-        print htmlspecialchars($body);
-        print "\n***** End of server response *****\n\n";
-    }
-    
-    // }}}
-    // {{{ printPostRequestDebugInformation()
-    
-    /**
-     * Display debug informations (part 2)
-     *
-     * @param mixed $result decoded server response
-     */
-    public static function printPostRequestDebugInformation($result)
-    {
-        print "***** Decoded result *****\n";
-        print_r($result);
-        print "\n***** End of decoded result *****";
-        print '
'; - } - - // }}} - // {{{ testMethodName___() - - /** - * Return true is the given method name is ok with XML/RPC spec. - * - * NB : The '___' at the end of the method name is to avoid collisions with - * XMLRPC __call() - * - * @param string $methodName method name - * @return boolean true if ok - */ - public static function testMethodName($methodName) - { - return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName)); - } - - // }}} - -} - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Client.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Client.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend.php'; -require_once 'XML/RPC2/ClientHelper.php'; -// }}} - -/** - * XML_RPC client class. Use this class to access remote methods. - * - * To use this class, construct it providing the server URL and method prefix. - * Then, call remote methods on the new instance as if they were local. - * - * Example: - * - * require_once 'XML_RPC2/Client.php'; - * - * $client = XML_RPC2_Client('http://xmlrpc.example.com/1.0/', 'example.'); - * $result = $client->hello('Sergio'); - * print($result); - * - * - * The above example will call the example.hello method on the xmlrpc.example.com - * server, under the /1.0/ URI. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Client -{ - // {{{ properties - - /** - * uri Field (holds the uri for the XML_RPC server) - * - * @var string - */ - protected $uri = null; - - /** - * proxy Field (holds the proxy server data) - * - * @var string - */ - protected $proxy = null; - - /** - * Holds the prefix to prepend to method names - * - * @var string - */ - protected $prefix = null; - - /** - * Holds the debug flag - * - * @var boolean - */ - protected $debug = false; - - /** - * Hold the encoding of the client request - * - * @var string - */ - protected $encoding = 'utf-8'; - - /** - * Holds the escaping method(s) of the client request - * - * @var string - */ - protected $escaping = array('non-ascii', 'non-print', 'markup'); - - /** - * Holds the SSL verify flag - * - * @var boolean - */ - protected $sslverify = true; - - /** - * Holds the connection timeout in milliseconds of the client request. - * - * @var integer - */ - protected $connectionTimeout = null; - - /** - * ugly hack flag to avoid http://bugs.php.net/bug.php?id=21949 - * - * see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos - */ - protected $uglyStructHack = true; - - /** - * Preconfigured HTTP_Request2 provided by the user - * - * @var HTTP_Request2 - */ - protected $httpRequest; - // }}} - - // {{{ constructor - - /** - * Construct a new XML_RPC2_Client. - * - * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). - * Optionally, some options may be set as an associative array. Accepted keys are : - * 'prefix', 'proxy', 'debug' => see correspondant property to get more informations - * 'encoding' => The XML encoding for the requests (optional, defaults to utf-8) - * 'sslverify' => boolean, true iff SSL certificates are to be verified against local cert database (optional, default false) - * 'connectionTimeout' => Timeout, in seconds, for the XML-RPC HTTP request (optional, default is no timeout) - * 'httpRequest' => Preconfigured HTTP_Request2 instance to be used in executing the XML-RPC calls (optional) - * - * @param string URI for the XML-RPC server - * @param array (optional) Associative array of options - */ - protected function __construct($uri, $options = array()) - { - if (!$uriParse = parse_url($uri)) { - throw new XML_RPC2_InvalidUriException(sprintf('Client URI \'%s\' is not valid', $uri)); - } - $this->uri = $uri; - if (isset($options['prefix'])) { - if (!(XML_RPC2_ClientHelper::testMethodName($options['prefix']))) { - throw new XML_RPC2_InvalidPrefixException(sprintf('Prefix \'%s\' is not valid', $options['prefix'])); - } - $this->prefix = $options['prefix']; - } - if (isset($options['proxy'])) { - if (!$proxyParse = parse_url($options['proxy'])) { - throw new XML_RPC2_InvalidProxyException(sprintf('Proxy URI \'%s\' is not valid', $options['proxy'])); - } - $this->proxy = $options['proxy']; - } - if (isset($options['debug'])) { - if (!(is_bool($options['debug']))) { - throw new XML_RPC2_InvalidDebugException(sprintf('Debug \'%s\' is not valid', $options['debug'])); - } - $this->debug = $options['debug']; - } - if (isset($options['encoding'])) { - // TODO : control & exception - $this->encoding = $options['encoding']; - } - if (isset($options['escaping'])) { - // TODO : control & exception - $this->escaping = $options['escaping']; - } - if (isset($options['uglyStructHack'])) { - $this->uglyStructHack = $options['uglyStructHack']; - } - if (isset($options['sslverify'])) { - if (!(is_bool($options['sslverify']))) { - throw new XML_RPC2_InvalidSslverifyException(sprintf('SSL verify \'%s\' is not valid', $options['sslverify'])); - } - $this->sslverify = $options['sslverify']; - } - if (isset($options['connectionTimeout'])) { - if (!(is_int($options['connectionTimeout']))) { - throw new XML_RPC2_InvalidConnectionTimeoutException(sprintf('Connection timeout \'%s\' is not valid', $options['connectionTimeout'])); - } - $this->connectionTimeout = $options['connectionTimeout']; - } - if (isset($options['httpRequest'])) { - $this->httpRequest = $options['httpRequest']; - } - } - - // }}} - // {{{ create() - - /** - * Factory method to select, create and return a XML_RPC2_Client backend - * - * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). - * - * Optionally, some options may be set. - * - * @param string URI for the XML-RPC server - * @param array (optional) associative array of options (see constructor) - */ - public static function create($uri, $options = array()) - { - if (isset($this)) { // Method called non-statically forward to remote call() as RPC - $this->__call('create', func_get_args()); - } - if (isset($options['backend'])) { - XML_RPC2_Backend::setBackend($options['backend']); - } - $backend = XML_RPC2_Backend::getClientClassname(); - return new $backend($uri, $options); - } - - // }}} - // {{{ __call() - - /** - * __call Catchall. This method catches remote method calls and provides for remote forwarding. - * - * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to - * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value - * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative - * proves inacurate -- as when encoding DateTime values -- you should present an instance of - * XML_RPC_Value in lieu of the native parameter. - * - * @param string Method name - * @param array Parameters - * @return mixed The call result, already decoded into native types - */ - public abstract function __call($methodName, $parameters); - - // }}} -} - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Exception.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Exception.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Exception.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Exception.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,360 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -/** - * XML_RPC2 base exception class. All XML_RPC2 originated exceptions inherit from XML_RPC2_Exception - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Exception extends Exception -{ -} - -/* Encoding and decoding values exceptions {{{ -/** - * XML_RPC2_InvalidTypeException is thrown whenever an invalid XML_RPC type is used in an operation - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidTypeException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidTypeException is thrown when creating DateTime value objects from invalid string datetime representations - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidDateFormatException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_EncodeException is thrown whenever a class is asked to encode itself in XML with invalid or not enough data. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_EncodeException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_DecodeException is thrown whenever there is a problem decoding transport XML - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_DecodeException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidTypeEncodeException is thrown whenever a class is asked to encode itself and provided a PHP type - * that can't be translated to XML_RPC - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidTypeEncodeException extends XML_RPC2_Exception -{ -} -/* }}} */ - -/** - * XML_RPC2_InvalidUriException is thrown whenever the XML_RPC2 client is asked to use an invalid uri - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidUriException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidPrefixException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC prefix - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidPrefixException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidPrefixException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC debug flag - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidDebugException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidSslverifyException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC SSL verify flag - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidSslverifyException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_InvalidConnectionTimeoutException is thrown whenever the XML_RPC2 - * client is asked to use an invalid XML/RPC connection timeout value - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_InvalidConnectionTimeoutException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_FaultException signals a XML-RPC response that contains a fault element instead of a regular params element. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_FaultException extends XML_RPC2_Exception -{ - - // {{{ properties - - /** - * Fault code (in the response body) - * - * @var string - */ - protected $faultCode = null; - - // }}} - // {{{ constructor - - /** Construct a new XML_RPC2_FaultException with a given message string and fault code - * - * @param string The message string, corresponding to the faultString present in the response body - * @param string The fault code, corresponding to the faultCode in the response body - */ - function __construct($messageString, $faultCode) - { - parent::__construct($messageString); - $this->faultCode = $faultCode; - } - - // }}} - // {{{ getFaultCode() - - /** - * FaultCode getter - * - * @return string fault code - */ - public function getFaultCode() - { - return $this->faultCode; - } - - // }}} - // {{{ getFaultString() - - /** - * FaultString getter - * - * This is an alias to getMessage() in order to respect XML-RPC nomenclature for faults - * - * @return string fault code - */ - public function getFaultString() - { - return $this->getMessage(); - } - - // }}} - // {{{ createFromDecode() - - /** - * Create a XML_RPC2_FaultException by decoding the corresponding xml string - * - * @param string $xml - * @return object a XML_RPC2_FaultException - */ - public static function createFromDecode($xml) { - require_once 'XML/RPC2/Backend/Php/Value.php'; - - // This is the only way I know of creating a new Document rooted in the provided simpleXMLFragment (needed for the xpath expressions that does not segfault sometimes - $xml = simplexml_load_string($xml->asXML()); - $struct = XML_RPC2_Backend_Php_Value::createFromDecode($xml->value)->getNativeValue(); - if (!(is_array($struct) && - array_key_exists('faultString', $struct) && - array_key_exists('faultCode', $struct))) throw new XML_RPC2_DecodeException('Unable to decode XML-RPC fault payload'); - - return new XML_RPC2_FaultException( $struct['faultString'], $struct['faultCode'] ); - } - - // }}} - -} - -/** - * XML_RPC2_UnknownMethodException is thrown when a non-existent method is remote-called - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_UnknownMethodException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_TransportException signal transport level exceptions that stop requests from reaching the server - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_TransportException extends XML_RPC2_Exception -{ -} - -/** - * XML_RPC2_ReceivedInvalidStatusCodeExceptionextends is thrown whenever the XML_RPC2 response to a request does not return a 200 http status code. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_ReceivedInvalidStatusCodeException extends XML_RPC2_TransportException -{ -} - -/** - * XML_RPC2_CurlException is thrown whenever an error is reported by the low level HTTP cURL library - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_CurlException extends XML_RPC2_TransportException -{ -} - -/** - * XML_RPC2_ConfigException is thrown whenever PHP config clashes with XML_RPC2 requirements or config - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_ConfigException extends XML_RPC2_Exception -{ -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Class.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Class.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Class.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Class.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Server/Method.php'; -require_once 'XML/RPC2/Server/CallHandler.php'; -// }}} - -/** - * This class is a server call handler which exposes a classe's static public methods. - * - * XML_RPC2_Server_Callhandler_Class is the preferred call handler to use when you are - * designing your XML-RPC server from the ground up. Usage is quite simple: - * - Create a class holding all of the XML-RPC server's exported procedures as public static methods (the interface class). - * - PhpDoc the classes' methods, including at least method signature (params and return types) and short description. - * - Use the XML_RPC2 factory method to create a server based on the interface class. - * A simple example: - * - * /** - * * echoecho echoes the message received - * * - * * @param string Message - * * @return string The echo - * {@*} - * class EchoServer { - * public static function echoecho($string) - * { - * return $string; - * } - * } - * - * require_once 'XML/RPC2/Server.php'; - * $server = XML_RPC2_Server::create('EchoServer'); - * $server->handleCall(); - * - * - * Use this call handler if you have designed your xml-rpc external interface as a set of - * public class methods on a given class. If, on the other hand, you intend to export an - * already existing class, it may be that not all of the methods you want to export are static. - * In that case, it is probably best to use XML_RPC2_Server_Callhandler_Instance instead. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - * @see XML_RPC2_Server::create - * @see XML_RPC2_Server_Callhandler_Instance - */ -class XML_RPC2_Server_Callhandler_Class extends XML_RPC2_Server_CallHandler -{ - - // {{{ properties - - /** - * name of target class - * - * @var string - */ - private $_className; - - // }}} - // {{{ constructor - - /** - * XML_RPC2_Server_Callhandler_Class Constructor. Creates a new call handler exporting the give static class' methods - * - * Before using this constructor, take a look at XML_RPC2_Server::create. The factory - * method is usually a quicker way of instantiating the server and its call handler. - * - * @see XML_RPC2_Server::create() - * @param string The Target class. Calls will be made on this class - * @param string Default prefix to prepend to all exported methods (defaults to '') - */ - public function __construct($className, $defaultPrefix) - { - $this->_className = $className; - $reflection = new ReflectionClass($className); - foreach ($reflection->getMethods() as $method) { - if ($method->isStatic() && $method->isPublic() && !$method->isAbstract() && !$method->isConstructor()) - { - $candidate = new XML_RPC2_Server_Method($method, $defaultPrefix); - if (!$candidate->isHidden()) $this->addMethod($candidate); - } - } - } - - // }}} - // {{{ __call() - - /** - * __call catchall. Delegate the method call to the target class, and return its result - * - * @param string Name of method to call - * @param array Array of parameters for call - * @return mixed Whatever the target method returned - */ - public function __call($methodName, $parameters) - { - if (!array_key_exists($methodName, $this->getMethods())) { - throw new XML_RPC2_UnknownMethodException("Method $methodName is not exported by this server"); - } - return call_user_func_array(array($this->_className, $this->getMethod($methodName)->getInternalMethod()), $parameters); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Instance.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Instance.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Instance.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler/Instance.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Server/Method.php'; -require_once 'XML/RPC2/Server/CallHandler.php'; -// }}} - -/** - * This class is a server call handler which exposes an instance's public methods. - * - * XML_RPC2_Server_Callhandler_Instance is the preferred call handler to use when - * you just need to quickly expose an already existing object. If designing a remote - * API from the ground up, it's best to use XML_RPC2_Server_Callhandler_Class instead. - * - * Usage is simple: - * - PhpDoc the methods, including at least method signature (params and return types) and short description. - * - Use the XML_RPC2 factory method to create a server based on the interface class. - * A simple example: - * - * class EchoServer { - * /** - * * Echo the message - * * - * * @param string The string to echo - * * @return string The echo - * {@*} - * public function echoecho($string) - * { - * return $string; - * } - * } - * - * require_once 'XML/RPC2/Server.php'; - * $someInstance = new EchoServer(); - * $server = XML_RPC2_Server::create($someInstance); - * $server->handleCall(); - * - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - * @see XML_RPC2_Server::create - * @see XML_RPC2_Server_Callhandler_Class - */ -class XML_RPC2_Server_Callhandler_Instance extends XML_RPC2_Server_CallHandler -{ - - // {{{ properties - - /** - * instance of target object - * - * @var mixed - */ - private $_instance; - - // }}} - // {{{ constructor - - /** - * XML_RPC2_Server_Callhandler_Class Constructor. Creates a new call handler exporting the given object methods - * - * Before using this constructor, take a look at XML_RPC2_Server::create. The factory - * method is usually a quicker way of instantiating the server and its call handler. - * - * @see XML_RPC2_Server::create() - * @param object The Target object. Calls will be made on this instance - * @param string Default prefix to prepend to all exported methods (defaults to '') - */ - public function __construct($instance, $defaultPrefix) - { - $this->_instance = $instance; - $reflection = new ReflectionClass(get_class($instance)); - foreach ($reflection->getMethods() as $method) { - if (!$method->isStatic() && $method->isPublic() && !$method->isConstructor()) - { - $candidate = new XML_RPC2_Server_Method($method, $defaultPrefix); - if (!$candidate->isHidden()) $this->addMethod($candidate); - } - } - } - - // }}} - // {{{ __call() - - /** - * __call catchall. Delegate the method call to the target object, and return its result - * - * @param string Name of method to call - * @param array Array of parameters for call - * @return mixed Whatever the target method returned - */ - public function __call($methodName, $parameters) - { - if (!array_key_exists($methodName, $this->getMethods())) { - throw new XML_RPC2_UnknownMethodException("Method $methodName is not exported by this server"); - } - return call_user_func_array(array($this->_instance, $this->getMethod($methodName)->getInternalMethod()), $parameters); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/CallHandler.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -// }}} - -/** - * A CallHandler is responsible for actually calling the server-exported methods from the exported class. - * - * This class is abstract and not meant to be used directly by XML_RPC2 users. - * - * XML_RPC2_Server_CallHandler provides the basic code for a call handler class. An XML_RPC2 Call Handler - * operates in tandem with an XML_RPC2 server to export a classe's methods. While XML_RPC2 Server - * is responsible for request decoding and response encoding, the Call Handler is responsible for - * delegating the actual method call to the intended target. - * - * Different server behaviours can be obtained by plugging different Call Handlers into the XML_RPC2_Server. - * Namely, there are two call handlers available: - * - XML_RPC2_Server_Callhandler_Class: Which exports a classe's public static methods - * - XML_RPC2_Server_Callhandler_Instance: Which exports an object's pubilc methods - * - * @see XML_RPC2_Server_Callhandler_Class - * @see XML_RPC2_Server_Callhandler_Instance - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Server_CallHandler -{ - - // {{{ properties - - /** - * methods Field : holds server methods - * - * @var array - */ - protected $methods = array(); - - // }}} - // {{{ getMethods() - - /** - * methods getter - * - * @return array Array of XML_RPC2_Server_Method instances - */ - public function getMethods() - { - return $this->methods; - } - - // }}} - // {{{ addMethod() - - /** - * method appender - * - * @param XML_RPC2_Server_Method Method to append to methods - */ - protected function addMethod(XML_RPC2_Server_Method $method) - { - $this->methods[$method->getName()] = $method; - } - - // }}} - // {{{ getMethod() - - /** - * method getter - * - * @param string Name of method to return - * @param XML_RPC2_Server_Method Method named $name - */ - public function getMethod($name) - { - if (isset($this->methods[$name])) { - return $this->methods[$name]; - } - return false; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input/PhpInput.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input/PhpInput.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input/PhpInput.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input/PhpInput.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// Dependencies {{{ -require_once('XML/RPC2/Server/Input.php'); -// }}} - -/** - * Class that feeds XML_RPC2 with input originating from php://input - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2011 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Server_Input_PhpInput implements XML_RPC2_Server_Input -{ - protected $input; - /** - * Return true if there is no input (input is empty) - * - * @return boolean True iff there is no input - */ - public function isEmpty() - { - if (!isset($this->input)) $this->readRequest(); - return empty($this->input); - } - /** - * Return the input as a string - * - * @return string The Input - */ - public function readRequest() - { - if (!isset($this->input)) { - $this->input = file_get_contents('php://input'); - } - - return $this->input; - } -} - diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input/RawPostData.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input/RawPostData.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input/RawPostData.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input/RawPostData.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// Dependencies {{{ -require_once('XML/RPC2/Server/Input.php'); -require_once('XML/RPC2/Exception.php'); -// }}} - -/** - * Class that feeds XML_RPC2 with input originating from - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2011 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Server_Input_RawPostData implements XML_RPC2_Server_Input -{ - protected $input; - /** - * Return true if there is no input (input is empty) - * - * @return boolean True iff there is no input - */ - public function isEmpty() - { - if (!isset($this->input)) $this->readRequest(); - $result = empty($this->input); - return $result; - } - /** - * Return the input as a string - * - * @return string The Input - */ - public function readRequest() - { - if (!isset($this->input) && !isset($GLOBALS['HTTP_RAW_POST_DATA'])) throw new XML_RPC2_ConfigException('XML_RPC2_Server_Input_RawPostData requested but PHP config does not show GLOBALS[\'HTTP_RAW_POST_DATA\'] as available'); - if (!isset($this->input)) $this->input = $GLOBALS['HTTP_RAW_POST_DATA']; - - return $this->input; - } -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Input.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Input.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -/** - * Interface for feeding input to an XML_RPC2_Server - * - * Classes to be used as input readers for XML_RPC2_Server instances - * should implement this interface - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2011 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -interface XML_RPC2_Server_Input -{ - /** - * Return true if there is no input (input is empty) - * - * @return boolean True iff there is no input - */ - public function isEmpty(); - /** - * Return the input as a string - * - * @return string The Input - */ - public function readRequest(); -} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Method.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Method.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server/Method.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server/Method.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,391 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -// }}} - -/** - * Class representing an XML-RPC exported method. - * - * This class is used internally by XML_RPC2_Server. External users of the - * package should not need to ever instantiate XML_RPC2_Server_Method - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Server_Method -{ - // {{{ properties - - /** - * Method signature parameters - * - * @var array - */ - private $_parameters; - - /** - * Method signature return type - * - * @var string - */ - private $_returns ; - - /** - * Method help, for introspection - * - * @var string - */ - private $_help; - - /** - * internalMethod field : method name in PHP-land - * - * @var string - */ - private $_internalMethod; - - /** - * hidden field : true if the method is hidden - * - * @var boolean - */ - private $_hidden; - - /** - * name Field : external method name - * - * @var string - */ - private $_name; - - /** - * Number of required parameters - * - * @var int - */ - private $_numberOfRequiredParameters; - - // }}} - // {{{ getInternalMethod() - - /** - * internalMethod getter - * - * @return string internalMethod - */ - public function getInternalMethod() - { - return $this->_internalMethod; - } - - // }}} - // {{{ isHidden() - - /** - * hidden getter - * - * @return boolean hidden value - */ - public function isHidden() - { - return $this->_hidden; - } - - // }}} - // {{{ getName() - - /** - * name getter - * - * @return string name - */ - public function getName() - { - return $this->_name; - } - - // }}} - // {{{ constructor - - /** - * Create a new XML-RPC method by introspecting a PHP method - * - * @param ReflectionMethod The PHP method to introspect - * @param string default prefix - */ - public function __construct(ReflectionMethod $method, $defaultPrefix) - { - $hidden = false; - $docs = $method->getDocComment(); - if (!$docs) { - $hidden = true; - } - $docs = explode("\n", $docs); - - $parameters = array(); - $methodname = null; - $returns = 'mixed'; - $shortdesc = ''; - $paramcount = -1; - $prefix = $defaultPrefix; - - // Extract info from Docblock - $paramDocs = array(); - foreach ($docs as $i => $doc) { - $doc = trim($doc, " \r\t/*"); - if (strlen($doc) && strpos($doc, '@') !== 0) { - if ($shortdesc) { - $shortdesc .= "\n"; - } - $shortdesc .= $doc; - continue; - } - if (strpos($doc, '@xmlrpc.hidden') === 0) { - $hidden = true; - } - if ((strpos($doc, '@xmlrpc.prefix') === 0) && preg_match('/@xmlrpc.prefix( )*(.*)/', $doc, $matches)) { - $prefix = $matches[2]; - } - if ((strpos($doc, '@xmlrpc.methodname') === 0) && preg_match('/@xmlrpc.methodname( )*(.*)/', $doc, $matches)) { - $methodname = $matches[2]; - } - if (strpos($doc, '@param') === 0) { // Save doctag for usage later when filling parameters - $paramDocs[] = $doc; - } - - if (strpos($doc, '@return') === 0) { - $param = preg_split("/\s+/", $doc); - if (isset($param[1])) { - $param = $param[1]; - $returns = $param; - } - } - } - $this->_numberOfRequiredParameters = $method->getNumberOfRequiredParameters(); // we don't use isOptional() because of bugs in the reflection API - // Fill in info for each method parameter - foreach ($method->getParameters() as $parameterIndex => $parameter) { - // Parameter defaults - $newParameter = array('type' => 'mixed'); - - // Attempt to extract type and doc from docblock - if (array_key_exists($parameterIndex, $paramDocs) && - preg_match('/@param\s+(\S+)(\s+(.+))/', $paramDocs[$parameterIndex], $matches)) { - if (strpos($matches[1], '|')) { - $newParameter['type'] = XML_RPC2_Server_Method::_limitPHPType(explode('|', $matches[1])); - } else { - $newParameter['type'] = XML_RPC2_Server_Method::_limitPHPType($matches[1]); - } - $tmp = '$' . $parameter->getName() . ' '; - if (strpos($matches[3], '$' . $tmp) === 0) { - $newParameter['doc'] = $matches[3]; - } else { - // The phpdoc comment is something like "@param string $param description of param" - // Let's keep only "description of param" as documentation (remove $param) - $newParameter['doc'] = substr($matches[3], strlen($tmp)); - } - $newParameter['doc'] = preg_replace('_^\s*_', '', $newParameter['doc']); - } - - $parameters[$parameter->getName()] = $newParameter; - } - - if (is_null($methodname)) { - $methodname = $prefix . $method->getName(); - } - - $this->_internalMethod = $method->getName(); - $this->_parameters = $parameters; - $this->_returns = $returns; - $this->_help = $shortdesc; - $this->_name = $methodname; - $this->_hidden = $hidden; - } - - // }}} - // {{{ matchesSignature() - - /** - * Check if method matches provided call signature - * - * Compare the provided call signature with this methods' signature and - * return true iff they match. - * - * @param string Signature to compare method name - * @param array Array of parameter values for method call. - * @return boolean True if call matches signature, false otherwise - */ - public function matchesSignature($methodName, $callParams) - { - if ($methodName != $this->_name) return false; - if (count($callParams) < $this->_numberOfRequiredParameters) return false; - if (count($callParams) > $this->_parameters) return false; - $paramIndex = 0; - foreach($this->_parameters as $param) { - $paramIndex++; - if ($paramIndex <= $this->_numberOfRequiredParameters) { - // the parameter is not optional - $callParamType = XML_RPC2_Server_Method::_limitPHPType(gettype($callParams[$paramIndex-1])); - if ((!($param['type'] == 'mixed')) and ($param['type'] != $callParamType)) { - return false; - } - } - } - return true; - } - - // }}} - // {{{ getHTMLSignature() - - /** - * Return a HTML signature of the method - * - * @return string HTML signature - */ - public function getHTMLSignature() - { - $name = $this->_name; - $returnType = $this->_returns; - $result = "($returnType) "; - $result .= "$name"; - $result .= "("; - $first = true; - $nbr = 0; - while (list($name, $parameter) = each($this->_parameters)) { - $nbr++; - if ($nbr == $this->_numberOfRequiredParameters + 1) { - $result .= " [ "; - } - if ($first) { - $first = false; - } else { - $result .= ', '; - } - $type = $parameter['type']; - $result .= "($type) "; - $result .= "$name"; - } - reset($this->_parameters); - if ($nbr > $this->_numberOfRequiredParameters) { - $result .= " ] "; - } - $result .= ")"; - return $result; - } - - // }}} - // {{{ autoDocument() - /** - * Print a complete HTML description of the method - */ - public function autoDocument() - { - $name = $this->getName(); - $signature = $this->getHTMLSignature(); - $id = md5($name); - $help = nl2br(htmlentities($this->_help)); - print "

$signature

\n"; - print "

Description :

\n"; - print "
\n"; - print " $help\n"; - print "
\n"; - if (count($this->_parameters)>0) { - print "

Parameters :

\n"; - if (count($this->_parameters)>0) { - print " \n"; - print " \n"; - while (list($name, $parameter) = each($this->_parameters)) { - $type = $parameter['type']; - $doc = isset($parameter['doc']) ? htmlentities($parameter['doc']) : 'Method is not documented. No PHPDoc block was found associated with the method in the source code.'; - print " \n"; - } - reset($this->_parameters); - print "
TypeNameDocumentation
$type$name$doc
\n"; - } - } - } - - // }}} - // {{{ _limitPHPType() - /** - * standardise type names between gettype php function and phpdoc comments (and limit to xmlrpc available types) - * - * @var string $type - * @return string standardised type - */ - private static function _limitPHPType($type) - { - $tmp = strtolower($type); - $convertArray = array( - 'int' => 'integer', - 'i4' => 'integer', - 'integer' => 'integer', - 'string' => 'string', - 'str' => 'string', - 'char' => 'string', - 'bool' => 'boolean', - 'boolean' => 'boolean', - 'array' => 'array', - 'float' => 'double', - 'double' => 'double', - 'array' => 'array', - 'struct' => 'array', - 'assoc' => 'array', - 'structure' => 'array', - 'datetime' => 'mixed', - 'datetime.iso8601' => 'mixed', - 'iso8601' => 'mixed', - 'base64' => 'string' - ); - if (isset($convertArray[$tmp])) { - return $convertArray[$tmp]; - } - return 'mixed'; - } - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Server.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Server.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,355 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend.php'; -require_once 'XML/RPC2/Server/Input.php'; -// }}} - - -/** - * XML_RPC2_Server is the frontend class for exposing PHP functions via XML-RPC. - * - * Exporting a programatic interface via XML-RPC using XML_RPC2 is exceedingly easy: - * - * The first step is to assemble all methods you wish to export into a class. You may either - * create a (abstract) class with exportable methods as static, or use an existing instance - * of an object. - * - * You'll then need to document the methods using PHPDocumentor tags. XML_RPC2 will use the - * documentation for server introspection. You'll get something like this: - * - * - * class ExampleServer { - * /** - * * hello says hello - * * - * * @param string Name - * * @return string Greetings - * {@*} - * public static function hello($name) - { - * return "Hello $name"; - * } - * } - * - * - * Now, instantiate the server, using the Factory method to select a backend and a call handler for you: - * - * require_once 'XML/RPC2/Server.php'; - * $server = XML_RPC2_Server::create('ExampleServer'); - * $server->handleCall(); - * - * - * This will create a server exporting all of the 'ExampleServer' class' methods. If you wish to export - * instance methods as well, pass an object instance to the factory instead: - * - * require_once 'XML/RPC2/Server.php'; - * $server = XML_RPC2_Server::create(new ExampleServer()); - * $server->handleCall(); - * - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Server -{ - - // {{{ properties - - /** - * callHandler field - * - * The call handler is responsible for executing the server exported methods - * - * @var mixed - */ - protected $callHandler = null; - - /** - * prefix field - * - * @var string - */ - protected $prefix = ''; - - /** - * encoding field - * - * TODO : work on encoding for this backend - * - * @var string - */ - protected $encoding = 'utf-8'; - - /** - * display html documentation of xmlrpc exported methods when there is no post datas - * - * @var boolean - */ - protected $autoDocument = true; - - /** - * display external links at the end of autodocumented page - * - * @var boolean - */ - protected $autoDocumentExternalLinks = true; - - /** - * signature checking flag - * - * if set to true, the server will check the method signature before - * calling the corresponding php method - * - * @var boolean - */ - protected $signatureChecking = true; - - /** - * input handler - * - * Implementation of XML_RPC2_Server_Input that feeds this server with input - * - * @var XML_RPC2_Server_Input - */ - protected $input; - - // }}} - // {{{ constructor - - /** - * Create a new XML-RPC Server. - * - * @param object $callHandler the call handler will receive a method call for each remote call received. - * @param array associative array of options - */ - protected function __construct($callHandler, $options = array()) - { - $this->callHandler = $callHandler; - if ((isset($options['prefix'])) && (is_string($options['prefix']))) { - $this->prefix = $options['prefix']; - } - if ((isset($options['encoding'])) && (is_string($options['encoding']))) { - $this->encoding = $options['encoding']; - } - if ((isset($options['autoDocument'])) && (is_bool($options['autoDocument']))) { - $this->autoDocument = $options['autoDocument']; - } - if ((isset($options['autoDocumentExternalLinks'])) && (is_bool($options['autoDocumentExternalLinks']))) { - $this->autoDocumentExternalLinks = $options['autoDocumentExternalLinks']; - } - if ((isset($options['signatureChecking'])) && (is_bool($options['signatureChecking']))) { - $this->signatureChecking = $options['signatureChecking']; - } - if (!isset($options['input'])) $options['input'] = 'XML_RPC2_Server_Input_RawPostData'; - if (is_string($options['input'])) { - $inputDir = strtr($options['input'], array('_' => DIRECTORY_SEPARATOR)) . '.php'; - require_once($inputDir); - $inputClass = $options['input']; - - $options['input'] = new $inputClass(); - } - if ($options['input'] instanceof XML_RPC2_Server_Input) { - $this->input = $options['input']; - } else { - throw new XML_RPC2_ConfigException('Invalid value for "input" option. It must be either a XML_RPC2_Server_Input subclass name or XML_RPC2_Server_Input subclass instance'); - } - } - - // }}} - // {{{ create() - - /** - * Factory method to select a backend and return a new XML_RPC2_Server based on the backend - * - * @param mixed $callTarget either a class name or an object instance. - * @param array associative array of options - * @return object a server class instance - */ - public static function create($callTarget, $options = array()) - { - if (isset($options['backend'])) { - XML_RPC2_Backend::setBackend($options['backend']); - } - if (isset($options['prefix'])) { - $prefix = $options['prefix']; - } else { - $prefix = ''; - } - $backend = XML_RPC2_Backend::getServerClassname(); - // Find callHandler class - if (!isset($options['callHandler'])) { - if (is_object($callTarget)) { // Delegate calls to instance methods - require_once 'XML/RPC2/Server/CallHandler/Instance.php'; - $callHandler = new XML_RPC2_Server_CallHandler_Instance($callTarget, $prefix); - } else { // Delegate calls to static class methods - require_once 'XML/RPC2/Server/CallHandler/Class.php'; - $callHandler = new XML_RPC2_Server_CallHandler_Class($callTarget, $prefix); - } - } else { - $callHandler = $options['callHandler']; - } - return new $backend($callHandler, $options); - } - - // }}} - // {{{ handleCall() - - /** - * Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response. - * - */ - public abstract function handleCall(); - - // }}} - // {{{ errorToException() - - /** - * Transform an error into an exception - * - * @param int $errno error number - * @param string $errstr error string - * @param string $errfile error file - * @param int $errline error line - */ - public static function errorToException($errno, $errstr, $errfile, $errline) - { - switch ($errno) { - case E_WARNING: - case E_NOTICE: - case E_USER_WARNING: - case E_USER_NOTICE: - case E_STRICT: - // Silence warnings - // TODO Logging should occur here - break; - default: - throw new Exception('Classic error reported "' . $errstr . '" on ' . $errfile . ':' . $errline); - } - } - - // }}} - // {{{ autoDocument() - /* autoDocument {{{ */ - /** - * autoDocument. Produce an HTML page from the result of server introspection - * - * @return string HTML document describing this server - */ - public function autoDocument() - /* }}} */ - { - print "\n"; - print "\n"; - print " \n"; - print " \n"; - print " Available XMLRPC methods for this server\n"; - print " \n"; - print " \n"; - print " \n"; - print "

Available XMLRPC methods for this server

\n"; - print "

Index

\n"; - print "
    \n"; - foreach ($this->callHandler->getMethods() as $method) { - $name = $method->getName(); - $id = md5($name); - $signature = $method->getHTMLSignature(); - print "
  • $name()
  • \n"; - } - print "
\n"; - print "

Details

\n"; - foreach ($this->callHandler->getMethods() as $method) { - print "
\n"; - $method->autoDocument(); - print "

(return to index)

\n"; - print "
\n"; - } - if (!($this->autoDocumentExternalLinks)) { - print '

Powered by PEAR/XML_RPC2       Valid XHTML 1.0 Strict       Valid CSS!

' . "\n"; - } - print " \n"; - print "\n"; - } - // }}} - // {{{ getContentLength() - - /** - * Gets the content legth of a serialized XML-RPC message in bytes - * - * @param string $content the serialized XML-RPC message. - * - * @return integer the content length in bytes. - */ - protected function getContentLength($content) - { - if (extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) == 2) { - $length = mb_strlen($content, '8bit'); - } else { - $length = strlen((binary)$content); - } - - return $length; - } - - // }}} -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Util/HTTPRequest.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Util/HTTPRequest.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Util/HTTPRequest.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Util/HTTPRequest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,248 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Client.php'; -require_once 'HTTP/Request2.php'; -// }}} - -/** - * XML_RPC utility HTTP request class. This class mimics a subset of PEAR's HTTP_Request - * and is to be refactored out of the package once HTTP_Request releases an E_STRICT version. - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2011 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -class XML_RPC2_Util_HTTPRequest -{ - - // {{{ properties - - /** - * proxy field - * - * @var string - */ - private $_proxy = null; - - /** - * proxyauth field - * - * @var string - */ - private $_proxyAuth = null; - - /** - * postData field - * - * @var string - */ - private $_postData; - - /** - * uri field - * - * @var array - */ - private $_uri; - - /** - * encoding for the request - * - * @var string - */ - private $_encoding='utf-8'; - - /** - * SSL verify flag - * - * @var boolean - */ - private $_sslverify=true; - - /** - * HTTP timeout length in seconds. - * - * @var integer - */ - private $_connectionTimeout = null; - - /** - * HTTP_Request2 backend - * - * @var integer - */ - private $_httpRequest = null; - - // }}} - // {{{ getBody() - - /** - * body field getter - * - * @return string body value - */ - public function getBody() - { - return $this->_body; - } - - // }}} - // {{{ setPostData() - - /** - * postData field setter - * - * @param string postData value - */ - public function setPostData($value) - { - $this->_postData = $value; - } - - // }}} - // {{{ constructor - - /** - * Constructor - * - * Sets up the object - * @param string The uri to fetch/access - * @param array Associative array of parameters which can have the following keys: - *
    - *
  • proxy - Proxy (string)
  • - *
  • encoding - The request encoding (string)
  • - *
  • sslverify
  • - The SSL verify flag (boolean) - *
  • connectionTimeout
  • - The connection timeout in milliseconds (integer) - *
  • httpRequest
  • - Preconfigured instance of HTTP_Request2 (optional) - *
- * @access public - */ - public function __construct($uri = '', $params = array()) - { - if (!preg_match('/(https?:\/\/)(.*)/', $uri)) throw new XML_RPC2_Exception('Unable to parse URI'); - $this->_uri = $uri; - if (isset($params['encoding'])) { - $this->_encoding = $params['encoding']; - } - if (isset($params['proxy'])) { - $proxy = $params['proxy']; - $elements = parse_url($proxy); - if (is_array($elements)) { - if ((isset($elements['scheme'])) and (isset($elements['host']))) { - $this->_proxy = $elements['scheme'] . '://' . $elements['host']; - } - if (isset($elements['port'])) { - $this->_proxy = $this->_proxy . ':' . $elements['port']; - } - if ((isset($elements['user'])) and (isset($elements['pass']))) { - $this->_proxyAuth = $elements['user'] . ':' . $elements['pass']; - } - } - } - if (isset($params['sslverify'])) { - $this->_sslverify = $params['sslverify']; - } - if (isset($params['connectionTimeout'])) { - $this->_connectionTimeout = $params['connectionTimeout']; - } - if (isset($params['httpRequest']) && $params['httpRequest'] instanceof HTTP_Request2) { - $this->_httpRequest = $params['httpRequest']; - } - } - - // }}} - // {{{ sendRequest() - - /** - * Sends the request - * - * @access public - * @return mixed PEAR error on error, true otherwise - */ - public function sendRequest() - { - if (is_null($this->_httpRequest)) $this->_httpRequest = new HTTP_Request2($this->_uri, HTTP_Request2::METHOD_POST); - $request = $this->_httpRequest; - $request->setUrl($this->_uri); - $request->setMethod(HTTP_Request2::METHOD_POST); - if (isset($params['proxy'])) { - $elements = parse_url($params['proxy']); - if (is_array($elements)) { - if ((isset($elements['scheme'])) and (isset($elements['host']))) { - $request->setConfig('proxy_host', $elements['host']); - } - if (isset($elements['port'])) { - $request->setConfig('proxy_port', $elements['port']); - } - if ((isset($elements['user'])) and (isset($elements['pass']))) { - $request->setConfig('proxy_user', $elements['user']); - $request->setConfig('proxy_password', $elements['pass']); - } - } - } - $request->setConfig('ssl_verify_peer', $this->_sslverify); - $request->setConfig('ssl_verify_host', $this->_sslverify); - $request->setHeader('Content-type: text/xml; charset='.$this->_encoding); - $request->setHeader('User-Agent: PEAR::XML_RPC2/@package_version@'); - $request->setBody($this->_postData); - if (isset($this->_connectionTimeout)) $request->setConfig('timeout', (int) ($this->_connectionTimeout / 1000)); - try { - $result = $request->send(); - if ($result->getStatus() != 200) throw new XML_RPC2_ReceivedInvalidStatusCodeException('Received non-200 HTTP Code: ' . $result->getStatus() . '. Response body:' . $result->getBody()); - - } catch (HTTP_Request2_Exception $e) { - throw new XML_RPC2_CurlException($e); - } - $this->_body = $result->getBody(); - return $result->getBody(); - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.2/XML/RPC2/Value.php 2014-03-30 12:11:29.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.2/XML/RPC2/Value.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ - | -* +-----------------------------------------------------------------------------+ -* -* @category XML -* @package XML_RPC2 -* @author Sergio Carvalho -* @copyright 2004-2006 Sergio Carvalho -* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 -* @version CVS: $Id$ -* @link http://pear.php.net/package/XML_RPC2 -*/ - -// }}} - -// dependencies {{{ -require_once 'XML/RPC2/Exception.php'; -require_once 'XML/RPC2/Backend.php'; -// }}} - -/** - * XML_RPC value abstract class. All XML_RPC value classes inherit from XML_RPC2_Value - * - * @category XML - * @package XML_RPC2 - * @author Sergio Carvalho - * @copyright 2004-2006 Sergio Carvalho - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/XML_RPC2 - */ -abstract class XML_RPC2_Value -{ - // {{{ createFromNative() - - /** - * Factory method that constructs the appropriate XML-RPC encoded type value - * - * @param mixed Value to be encode - * @param string (optional) Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type) - * @return mixed The encoded value - */ - public static function createFromNative($value, $explicitType = null) - { - $xmlrpcTypes = array('int', 'boolean', 'string', 'double', 'datetime', 'base64', 'struct', 'array'); - if (in_array($explicitType, $xmlrpcTypes)) { - return @call_user_func(array(XML_RPC2_Backend::getValueClassname(), 'createFromNative'), $value, $explicitType); - } - return $value; - } - - // }}} - -} - -?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/composer.json php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/composer.json --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/composer.json 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/composer.json 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,44 @@ +{ + "name": "pear/xml_rpc2", + "description": "More info available on: http://pear.php.net/package/XML_RPC2", + "type": "library", + "license": "LGPL-2.1", + "support": { + "docs": "http://pear.php.net/package/XML_RPC2", + "issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=XML_RPC2", + "source": "https://github.com/pear/XML_RPC2" + }, + "authors": [ + { + "email": "sergiosgc@php.net", + "name": "Sergio Carvalho", + "role": "Lead" + }, + { + "email": "fab@php.net", + "name": "Fabien MARTY", + "role": "Developer" + }, + { + "email": "jal@ambitonline.com", + "name": "Alan Langford", + "role": "Developer" + } + ], + "require": { + "php": ">=5.2.0", + "pear/pear_exception": "^1.0.0", + "pear/http_request2": "^2.3.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "autoload": { + "psr-0": { + "XML_RPC2": "" + } + }, + "include-path": [ + "./" + ] +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/docs/Makefile php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/docs/Makefile --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/docs/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/docs/Makefile 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,2 @@ +phpdoc: + diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/docs/tutorials/XML_RPC2.lyx php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/docs/tutorials/XML_RPC2.lyx --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/docs/tutorials/XML_RPC2.lyx 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/docs/tutorials/XML_RPC2.lyx 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,320 @@ +#LyX 1.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 221 +\textclass docbook-section +\language english +\inputencoding auto +\fontscheme default +\graphics default +\paperfontsize default +\spacing single +\papersize Default +\paperpackage a4 +\use_geometry 0 +\use_amsmath 0 +\use_natbib 0 +\use_numerical_citations 0 +\paperorientation portrait +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\quotes_times 2 +\papercolumns 1 +\papersides 1 +\paperpagestyle default + +\layout Title +\added_space_top vfill \added_space_bottom vfill +XML_RPC2 Tutorial +\layout Abstract + +This tutorial introduces basic usage of XML_RPC2 as a client/server library + in XML_RPC operations. + XML_RPC2 is a pear package providing XML_RPC client and server services. + XML-RPC is a simple remote procedure call protocol built using HTTP as + transport and XML as encoding. +\layout Abstract + +As a client library, XML_RPC2 is capable of creating a proxy class which + exposes the methods exported by the server. + As a server library, XML_RPC2 is capable of exposing methods from a class + or object instance, seamlessly exporting local methods as remotely callable + procedures. + +\layout Subsection + +Client usage +\layout Subsubsection + +Basic Usage +\layout Standard + +The most simple way to use the XML_RPC client is by letting XML_RPC2 select + the backend for you, and just give the client factory method the data referring + to the server: +\layout Itemize + +The server URI. +\layout Itemize + +The HTTP proxy URI (null if no proxy). +\layout Itemize + +The method prefix +\layout Code + +require_once('XML/RPC2/Client.php'); +\layout Code + +$client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, ''); +\layout Standard + +The factory will produce a client proxy. + This class exports whichever methods the server exports. + These methods are called just like regular local methods: +\layout Code + +print($client->hello('World')); +\layout Standard + +for a server that exports the method hello. + If the server has methods prefixed by a classname (example.hello), there + are two solutions. + Either call the method using brackets enclosing the otherwise php-invalid + method name: +\layout Code + +print($client->{example.hello}('World')); +\layout Standard + +Or specify a method prefix when creating the client instance: +\layout Code + +$client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, 'example.'); +\layout Code + +print($client->hello('World')); +\layout Subsubsection + +Error handling +\layout Standard + +XML_RPC2 uses exceptions to signal errors. + The phpdoc reference contains a class hierarchy useful to get a grasp of + possible errors. + The most important characteristics of the XML_RPC2 exception tree are: +\layout Itemize + +All XML_RPC2 exceptions are children of XML_RPC2_Exception. + If you want to filter out exceptions from this package, catch XML_RPC2_Exceptio +n +\layout Itemize + +Network failure is signaled by an XML_RPC2_TransportException +\layout Itemize + +Regular XML-RPC fault responses are signaled by an XML_RPC2_FaultException +\layout Itemize + +All other types of XML_RPC2_Exception signal package misuse or bug-induced + misbehaviour +\layout Standard + +Standard usage: +\layout Code + +require_once('XMLrequire_once('XML/RPC2/Client.php'); +\layout Code + +try { +\layout Code + + $client = XML_RPC2_Client::create('http://rpc.example.com:80/', null, + ''); +\layout Code + + print($client->hello('World')); +\layout Code + +} catch (XML_RPC2_TransportException transportException) { +\layout Code + + // Handle network-induced exception +\layout Code + +} catch (XML_RPC2_FaultException fault) { +\layout Code + + // Handle fault returned by remote server +\layout Code + +} catch (XML_RPC2_Exception xmlRpcException) { +\layout Code + + // Handle abnormal XML_RPC2 package exception +\layout Code + +} catch (Exception e) { +\layout Code + + // Handle someone else's fault exception +\layout Code + +} +\layout Standard + +It is good practice to at least expect XML_RPC2_TransportException as network + failure can't ever be ruled out. + +\layout Subsection + +Server usage +\layout Subsubsection + +Basic Usage +\layout Standard + +To export an XML-RPC server using XML_RPC2, the first step is writing the + methods to export. + XML_RPC2 can export class methods (static methods) for a class, or all + methods for an object instance. + For this example, we'll export a class' static methods: +\layout Code + +class EchoServer { +\layout Code + + /** +\layout Code + + * echoecho echoes the message received +\layout Code + + * +\layout Code + + * @param string Message +\layout Code + + * @return string The echo +\layout Code + + */ +\layout Code + +\layout Code + + public static function echoecho($string) +\layout Code + + { +\layout Code + + return $string; +\layout Code + + } +\layout Code + + +\layout Code + + /** +\layout Code + + * Dummy method which won't be exported +\layout Code + + * +\layout Code + + * @xmlrpc.hidden +\layout Code + + */ +\layout Code + + public static function dummy() +\layout Code + + { +\layout Code + + return false; +\layout Code + + } +\layout Code + +\layout Code + + /** +\layout Code + + * hello says hello +\layout Code + + * +\layout Code + + * @param string Name +\layout Code + + * @return string Hello 'name' +\layout Code + + */ +\layout Code + + public function hello($name) +\layout Code + + { +\layout Code + + return "Hello $name"; +\layout Code + + } +\layout Code + +\layout Code + +} +\layout Standard + +Note that the method is documented using phpDoc docblocks. + The docblock is used to deduce the signature and method documentation, + required by the XML-RPC spec. + Non-documented methods are not exported. + Methods tagged with the tag @xmlrpc.hidden are not exported either (the + dummy method above won't be exported). +\layout Standard + +After creating the class, we need to get an XML_RPC2 server to export its + methods remotely: +\layout Code + +require_once 'XML/RPC2/Server.php'; +\layout Code + +$server = XML_RPC2_Server::create('EchoServer'); +\layout Code + +$server->handleCall(); +\layout Standard + +The XML_RPC2_Server automatically exports all of the EchoServer class public + static methods (echoecho in this case). + You may also export all of an instance's public methods (static or otherwise): +\layout Code + +require_once 'XML/RPC2/Server.php'; +\layout Code + +$server = XML_RPC2_Server::create(new EchoServer()); +\layout Code + +$server->handleCall(); +\the_end diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/Makefile php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/Makefile --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/Makefile 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,15 @@ +run-tests: + make -C tests run-tests + + +phpdoc: + monotone log > CHANGELOG + make -C docs phpdoc + cp CHANGELOG XML + phpdoc --directory XML,docs/tutorials --examplesdir docs/examples --target docs/phpdoc --title "XML_RPC2 Documentation" --parseprivate --defaultpackagename XML_RPC2 --pear -ric --output HTML:Smarty:PHP + rm -f XML/CHANGELOG + +clean: + make -C tests clean + rm -Rf docs/phpdoc + rm -f CHANGELOG diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/README.md php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/README.md --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/README.md 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/README.md 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,36 @@ +PEAR XML_RPC2 +============= +XML_RPC2 is a pear package providing XML_RPC client and server services. +XML-RPC is a simple remote procedure call protocol built using HTTP as +transport and XML as encoding. As a client library, XML_RPC2 is capable of +creating a proxy class which exposes the methods exported by the server. As a +server library, XML_RPC2 is capable of exposing methods from a class or object +instance, seamlessly exporting local methods as remotely callable procedures. + +Basic Usage +----------- +```php + 'package.' +); + +$client = XML_RPC2_Client::create( + 'http://pear.php.net/xmlrpc.php', + $options +); + +try { + $result = $client->info('XML_RPC2'); + print_r($result); +} catch (XML_RPC2_FaultException $e) { + // The XMLRPC server returns a XMLRPC error + die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString()); +} catch (Exception $e) { + // Other errors (HTTP or networking problems...) + die('Exception : ' . $e->getMessage()); +} + +?> +``` diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/lib/run-tests php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/lib/run-tests --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/lib/run-tests 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/lib/run-tests 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,917 @@ + $value) { + putenv("$key=$value"); +} +/* + +----------------------------------------------------------------------+ + | PHP Version 4 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2002 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Ilia Alshanetsky | + | Preston L. Bannister | + | Marcus Boerger | + | Derick Rethans | + | Sander Roobol | + | (based on version by: Stig Bakken ) | + | (based on the PHP 3 test framework by Rasmus Lerdorf) | + +----------------------------------------------------------------------+ + */ + +/* + Require exact specification of PHP executable to test (no guessing!). + Die if any internal errors encountered in test script. + Regularized output for simpler post-processing of output. + Optionally output error lines indicating the failing test source and log + for direct jump with MSVC or Emacs. +*/ + +/* + * TODO: + * - do not test PEAR components if base class and/or component class cannot be instanciated + */ + + +/* Sanity check to ensure that pcre extension needed by this script is avaliable. + * In the event it is not, print a nice error message indicating that this script will + * not run without it. + */ + +if (!extension_loaded("pcre")) { + echo <<'; +save_text($info_file, $php_info); +global $ini_overwrites; +$ini_overwrites = array( + 'mbstring.script_encoding=pass', + 'output_handler=', + 'zlib.output_compression=Off', + 'open_basedir=', + 'safe_mode=0', + 'disable_functions=', + 'output_buffering=Off', + 'error_reporting=2047', + 'display_errors=1', + 'log_errors=0', + 'html_errors=0', + 'track_errors=1', + 'report_memleaks=1', + 'docref_root=/phpmanual/', + 'docref_ext=.html', + 'error_prepend_string=', + 'error_append_string=', + 'auto_prepend_file=', + 'auto_append_file=', + 'magic_quotes_runtime=0', + ); +global $info_params; +$info_params = array(); +settings2array($ini_overwrites,$info_params); +$save = $info_params; +settings2paramsnoquotes($info_params); +$curdir = getcwd(); +chdir(dirname($info_file)); +$info_filename = basename($info_file); +$php_info = `"$php" $info_params $info_filename`; +chdir($curdir); +@unlink($info_file); +//$info_params = $save; +//settings2params($info_params); +define('TESTED_PHP_VERSION', `"$php" -r 'echo PHP_VERSION;'`); + +// Write test context information. + +echo " +===================================================================== +CWD : $cwd +PHP : $php $php_info +Extra dirs : "; +foreach ($user_tests as $test_dir) { + echo "{$test_dir}\n "; +} +echo " +===================================================================== +"; + +// Determine the tests to be run. +global $test_files, $test_results; +$test_files = array(); +$test_results = array(); +$GLOBALS['__PHP_FAILED_TESTS__'] = array(); + +// If parameters given assume they represent selected tests to run. +if (isset($argc) && $argc > 1) { + for ($i=1; $i<$argc; $i++) { + $testfile = realpath($argv[$i]); + if (is_dir($testfile)) { + find_files($testfile); + } else if (preg_match("/\.phpt$/", $testfile)) { + $test_files[] = $testfile; + } + } + $test_files = array_unique($test_files); + + // Run selected tests. + if (count($test_files)) { + usort($test_files, "test_sort"); + echo "Running selected tests.\n"; + foreach($test_files AS $name) { + $test_results[$name] = run_test($php,$name); + } + if (getenv('REPORT_EXIT_STATUS') == 1 and @ereg('FAILED( |$)', implode(' ', $test_results))) { + exit(1); + } + exit(0); + } +} + +// Compile a list of all test files (*.phpt). +$test_files = array(); +$exts_to_test = get_loaded_extensions(); +$exts_tested = count($exts_to_test); +$exts_skipped = 0; +$ignored_by_ext = 0; +sort($exts_to_test); +$test_dirs = array('tests', 'pear', 'ext'); + +foreach ($test_dirs as $dir) { + find_files("{$cwd}/{$dir}", ($dir == 'ext')); +} + +foreach ($user_tests as $dir) { + find_files($dir, ($dir == 'ext')); +} + +function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE) +{ + print($dir . "\n"); + global $test_files, $exts_to_test, $ignored_by_ext, $exts_skipped, $exts_tested; + + $o = opendir($dir) or error("cannot open directory: $dir"); + while (($name = readdir($o)) !== FALSE) { + if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 'CVS'))) { + $skip_ext = ($is_ext_dir && !in_array($name, $exts_to_test)); + if ($skip_ext) { + $exts_skipped++; + } + find_files("{$dir}/{$name}", FALSE, $ignore || $skip_ext); + } + + // Cleanup any left-over tmp files from last run. + if (substr($name, -4) == '.tmp') { + @unlink("$dir/$name"); + continue; + } + + // Otherwise we're only interested in *.phpt files. + if (substr($name, -5) == '.phpt') { + if ($ignore) { + $ignored_by_ext++; + } else { + $testfile = realpath("{$dir}/{$name}"); + $test_files[] = $testfile; + } + } + } + closedir($o); +} + +function test_sort($a, $b) { + global $cwd; + + $ta = strpos($a, "{$cwd}/tests")===0 ? 1 + (strpos($a, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; + $tb = strpos($b, "{$cwd}/tests")===0 ? 1 + (strpos($b, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; + if ($ta == $tb) { + return strcmp($a, $b); + } else { + return $tb - $ta; + } +} + +$test_files = array_unique($test_files); +usort($test_files, "test_sort"); + +$start_time = time(); + +echo "TIME START " . date('Y-m-d H:i:s', $start_time) . " +===================================================================== +"; + +foreach ($test_files as $name) { + $test_results[$name] = run_test($php,$name); +} + +$end_time = time(); + +// Summarize results + +if (0 == count($test_results)) { + echo "No tests were run.\n"; + return; +} + +$n_total = count($test_results); +$n_total += $ignored_by_ext; + +$sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 'FAILED'=>0); +foreach ($test_results as $v) { + $sum_results[$v]++; +} +$sum_results['SKIPPED'] += $ignored_by_ext; +$percent_results = array(); +while (list($v,$n) = each($sum_results)) { + $percent_results[$v] = (100.0 * $n) / $n_total; +} + +echo " +===================================================================== +TIME END " . date('Y-m-d H:i:s', $end_time); + +$summary = " +===================================================================== +TEST RESULT SUMMARY +--------------------------------------------------------------------- +Exts skipped : " . sprintf("%4d",$exts_skipped) . " +Exts tested : " . sprintf("%4d",$exts_tested) . " +--------------------------------------------------------------------- +Number of tests : " . sprintf("%4d",$n_total) . " +Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . " +Tests warned : " . sprintf("%4d (%2.1f%%)",$sum_results['WARNED'],$percent_results['WARNED']) . " +Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . " +Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . " +--------------------------------------------------------------------- +Time taken : " . sprintf("%4d seconds", $end_time - $start_time) . " +===================================================================== +"; +echo $summary; + +$failed_test_summary = ''; +if (count($GLOBALS['__PHP_FAILED_TESTS__'])) { + $failed_test_summary .= " +===================================================================== +FAILED TEST SUMMARY +--------------------------------------------------------------------- +"; + foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $failed_test_data) { + $failed_test_summary .= $failed_test_data['test_name'] . $failed_test_data['info'] . "\n"; + } + $failed_test_summary .= "=====================================================================\n"; +} + +if ($failed_test_summary && !getenv('NO_PHPTEST_SUMMARY')) { + echo $failed_test_summary; +} + +define('PHP_QA_EMAIL', 'php-qa@lists.php.net'); +define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); + +/* We got failed Tests, offer the user to send and e-mail to QA team, unless NO_INTERACTION is set */ +if (!getenv('NO_INTERACTION')) { + $fp = fopen("php://stdin", "r+"); + echo "\nPlease allow this report to be sent to the PHP QA\nteam. This will give us a better understanding in how\n"; + echo "PHP's test cases are doing. Note that the report will include\ndetailed configuration data about your system\n"; + echo "so if you are worried about exposing sensitive data,\nsave this to a file first and remove any sensitive data\n"; + echo "and then send this file to php-qa@lists.php.net.\n"; + echo "(choose \"s\" to just save the results to a file)? [Yns]: "; + flush(); + $user_input = fgets($fp, 10); + $just_save_results = (strtolower($user_input[0]) == 's'); + + if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { + /* + * Collect information about the host system for our report + * Fetch phpinfo() output so that we can see the PHP enviroment + * Make an archive of all the failed tests + * Send an email + */ + + /* Ask the user to provide an email address, so that QA team can contact the user */ + if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { + echo "\nPlease enter your email address.\n(You address will be mangled so that it will not go out on any\nmailinglist in plain text): "; + flush(); + $fp = fopen("php://stdin", "r+"); + $user_email = trim(fgets($fp, 1024)); + $user_email = str_replace("@", " at ", str_replace(".", " dot ", $user_email)); + } + + $failed_tests_data = ''; + $sep = "\n" . str_repeat('=', 80) . "\n"; + + $failed_tests_data .= $failed_test_summary . "\n"; + $failed_tests_data .= $summary . "\n"; + + if ($sum_results['FAILED']) { + foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $test_info) { + $failed_tests_data .= $sep . $test_info['name'] . $test_info['info']; + $failed_tests_data .= $sep . file_get_contents(realpath($test_info['output'])); + $failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff'])); + $failed_tests_data .= $sep . "\n\n"; + } + $status = "failed"; + } else { + $status = "success"; + } + + $failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep; + $failed_tests_data .= "OS:\n" . PHP_OS . " - " . php_uname() . "\n\n"; + $ldd = $automake = $autoconf = $libtool = $compiler = 'N/A'; + + if (substr(PHP_OS, 0, 3) != "WIN") { + $automake = shell_exec('automake --version'); + $autoconf = shell_exec('autoconf --version'); + /* Always use the generated libtool - Mac OSX uses 'glibtool' */ + $libtool = shell_exec('./libtool --version'); + /* Try the most common flags for 'version' */ + $flags = array('-v', '-V', '--version'); + $cc_status=0; + foreach($flags AS $flag) { + system(getenv('CC')." $flag >/dev/null 2>&1", $cc_status); + if ($cc_status == 0) { + $compiler = shell_exec(getenv('CC')." $flag 2>&1"); + break; + } + } + $ldd = shell_exec("ldd $php"); + } + $failed_tests_data .= "Automake:\n$automake\n"; + $failed_tests_data .= "Autoconf:\n$autoconf\n"; + $failed_tests_data .= "Libtool:\n$libtool\n"; + $failed_tests_data .= "Compiler:\n$compiler\n"; + $failed_tests_data .= "Bison:\n". @shell_exec('bison --version'). "\n"; + $failed_tests_data .= "Libraries:\n$ldd\n"; + $failed_tests_data .= "\n"; + + if (isset($user_email)) { + $failed_tests_data .= "User's E-mail: ".$user_email."\n\n"; + } + + $failed_tests_data .= $sep . "PHPINFO" . $sep; + $failed_tests_data .= shell_exec($php.' -dhtml_errors=0 -i'); + + $compression = 0; + + if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) { + $output_file = 'php_test_results_' . date('Ymd') . ( $compression ? '.txt.gz' : '.txt' ); + $fp = fopen($output_file, "w"); + fwrite($fp, $failed_tests_data); + fclose($fp); + + if (!$just_save_results) { + echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n"; + } + + echo "Please send ".$output_file." to ".PHP_QA_EMAIL." manually, thank you.\n"; + } else { + fwrite($fp, "\nThank you for helping to make PHP better.\n"); + fclose($fp); + } + } +} + +if (getenv('REPORT_EXIT_STATUS') == 1 and $sum_results['FAILED']) { + exit(1); +} + +// +// Send Email to QA Team +// + +function mail_qa_team($data, $compression, $status = FALSE) +{ + $url_bits = parse_url(QA_SUBMISSION_PAGE); + if (empty($url_bits['port'])) $url_bits['port'] = 80; + + $data = "php_test_data=" . urlencode(base64_encode(preg_replace("/[\\x00]/", "[0x0]", $data))); + $data_length = strlen($data); + + $fs = fsockopen($url_bits['host'], $url_bits['port'], $errno, $errstr, 10); + if (!$fs) { + return FALSE; + } + + $php_version = urlencode(TESTED_PHP_VERSION); + + echo "\nPosting to {$url_bits['host']} {$url_bits['path']}\n"; + fwrite($fs, "POST ".$url_bits['path']."?status=$status&version=$php_version HTTP/1.1\r\n"); + fwrite($fs, "Host: ".$url_bits['host']."\r\n"); + fwrite($fs, "User-Agent: QA Browser 0.1\r\n"); + fwrite($fs, "Content-Type: application/x-www-form-urlencoded\r\n"); + fwrite($fs, "Content-Length: ".$data_length."\r\n\r\n"); + fwrite($fs, $data); + fwrite($fs, "\r\n\r\n"); + fclose($fs); + + return 1; +} + + +// +// Write the given text to a temporary file, and return the filename. +// + +function save_text($filename,$text) +{ + $fp = @fopen($filename,'w') or error("Cannot open file '" . $filename . "' (save_text)"); + fwrite($fp,$text); + fclose($fp); + if (1 < DETAILED) echo " +FILE $filename {{{ +$text +}}} +"; +} + +// +// Write an error in a format recognizable to Emacs or MSVC. +// + +function error_report($testname,$logname,$tested) +{ + $testname = realpath($testname); + $logname = realpath($logname); + switch (strtoupper(getenv('TEST_PHP_ERROR_STYLE'))) { + case 'MSVC': + echo $testname . "(1) : $tested\n"; + echo $logname . "(1) : $tested\n"; + break; + case 'EMACS': + echo $testname . ":1: $tested\n"; + echo $logname . ":1: $tested\n"; + break; + } +} + +// +// Run an individual test case. +// + +function run_test($php,$file) +{ + global $log_format, $info_params, $ini_overwrites; + + if (DETAILED) echo " +================= +TEST $file +"; + + // Load the sections of the test file. + $section_text = array( + 'TEST' => '(unnamed test)', + 'SKIPIF' => '', + 'GET' => '', + 'ARGS' => '', + ); + + $fp = @fopen($file, "r") or error("Cannot open test file: $file"); + + $section = ''; + while (!feof($fp)) { + $line = fgets($fp); + + // Match the beginning of a section. + if (@ereg('^--([A-Z]+)--',$line,$r)) { + $section = $r[1]; + $section_text[$section] = ''; + continue; + } + + // Add to the section text. + $section_text[$section] .= $line; + } + fclose($fp); + + /* For GET/POST tests, check if cgi sapi is avaliable and if it is, use it. */ + if ((!empty($section_text['GET']) || !empty($section_text['POST']))) { + if (file_exists("./sapi/cgi/php")) { + $old_php = $php; + $php = realpath("./sapi/cgi/php") . ' -C '; + } + } + + $shortname = str_replace($GLOBALS['cwd'].'/', '', $file); + $tested = trim($section_text['TEST'])." [$shortname]"; + + $tmp = realpath(dirname($file)); + if (!is_dir($tmp)) { + $tmp = dirname($file); + } + $tmp_skipif = $tmp . uniqid('/phpt.'); + $tmp_file = @ereg_replace('\.phpt$','.php',$file); + $tmp_post = $tmp . uniqid('/phpt.'); + + @unlink($tmp_skipif); + @unlink($tmp_file); + @unlink($tmp_post); + + // unlink old test results + @unlink(@ereg_replace('\.phpt$','.diff',$file)); + @unlink(@ereg_replace('\.phpt$','.log',$file)); + @unlink(@ereg_replace('\.phpt$','.exp',$file)); + @unlink(@ereg_replace('\.phpt$','.out',$file)); + + // Reset environment from any previous test. + putenv("REDIRECT_STATUS="); + putenv("QUERY_STRING="); + putenv("PATH_TRANSLATED="); + putenv("SCRIPT_FILENAME="); + putenv("REQUEST_METHOD="); + putenv("CONTENT_TYPE="); + putenv("CONTENT_LENGTH="); + + // Check if test should be skipped. + $info = ''; + $warn = false; + if (array_key_exists('SKIPIF', $section_text)) { + if (trim($section_text['SKIPIF'])) { + save_text($tmp_skipif, $section_text['SKIPIF']); + + $curdir = getcwd(); + chdir(dirname($tmp_skipif)); + $t_s = basename($tmp_skipif); + $output = `"$php" $info_params -f $t_s`; + chdir($curdir); + @unlink($tmp_skipif); + if (@eregi("^skip", trim($output))) { + echo "SKIP $tested"; + $reason = (@eregi("^skip[[:space:]]*(.+)\$", trim($output))) ? @eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; + if ($reason) { + echo " (reason: $reason)\n"; + } else { + echo "\n"; + } + if (isset($old_php)) { + $php = $old_php; + } + return 'SKIPPED'; + } + if (@eregi("^info", trim($output))) { + $reason = (@ereg("^info[[:space:]]*(.+)\$", trim($output))) ? @ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; + if ($reason) { + $info = " (info: $reason)"; + } + } + if (@eregi("^warn", trim($output))) { + $reason = (@ereg("^warn[[:space:]]*(.+)\$", trim($output))) ? @ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; + if ($reason) { + $warn = true; /* only if there is a reason */ + $info = " (warn: $reason)"; + } + } + } + } + + // Default ini settings + $ini_settings = array(); + // additional ini overwrites + //$ini_overwrites[] = 'setting=value'; + settings2array($ini_overwrites, $ini_settings); + + // Any special ini settings + // these may overwrite the test defaults... + if (array_key_exists('INI', $section_text)) { + settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings); + } + settings2paramsnoquotes($ini_settings); + + // We've satisfied the preconditions - run the test! + save_text($tmp_file,$section_text['FILE']); + if (array_key_exists('GET', $section_text)) { + $query_string = trim($section_text['GET']); + } else { + $query_string = ''; + } + + putenv("REDIRECT_STATUS=1"); + putenv("QUERY_STRING=$query_string"); + putenv("PATH_TRANSLATED=$tmp_file"); + putenv("SCRIPT_FILENAME=$tmp_file"); + + $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; + + if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { + + $post = trim($section_text['POST']); + save_text($tmp_post,$post); + $content_length = strlen($post); + + putenv("REQUEST_METHOD=POST"); + putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); + putenv("CONTENT_LENGTH=$content_length"); + + $cmd = "\"$php\"$ini_settings -f $tmp_file 2>&1 < \"$tmp_post\""; + + } else { + + putenv("REQUEST_METHOD=GET"); + putenv("CONTENT_TYPE="); + putenv("CONTENT_LENGTH="); + + $cmd = "\"$php\"$ini_settings -f $tmp_file$args 2>&1"; + } + + if (DETAILED) echo " +CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . " +CONTENT_TYPE = " . getenv("CONTENT_TYPE") . " +PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . " +QUERY_STRING = " . getenv("QUERY_STRING") . " +REDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . " +REQUEST_METHOD = " . getenv("REQUEST_METHOD") . " +SCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . " +COMMAND $cmd +"; + + $out = `$cmd`; + + @unlink($tmp_post); + + // Does the output match what is expected? + $output = trim($out); + $output = preg_replace('/\r\n/',"\n",$output); + + /* when using CGI, strip the headers from the output */ + if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) { + $output = substr($output, ($pos + 2)); + } + + if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { + if (isset($section_text['EXPECTF'])) { + $wanted = trim($section_text['EXPECTF']); + } else { + $wanted = trim($section_text['EXPECTREGEX']); + } + $wanted_re = preg_replace('/\r\n/',"\n",$wanted); + if (isset($section_text['EXPECTF'])) { + $wanted_re = preg_quote($wanted_re, '/'); + // Stick to basics + $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy + $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); + $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); + $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); + $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); + $wanted_re = str_replace("%c", ".", $wanted_re); + // %f allows two points "-.0.0" but that is the best *simple* expression + } +/* DEBUG YOUR REGEX HERE + var_dump($wanted_re); + print(str_repeat('=', 80) . "\n"); + var_dump($output); +*/ + if (preg_match("/^$wanted_re\$/s", $output)) { + @unlink($tmp_file); + echo "PASS $tested$info\n"; + if (isset($old_php)) { + $php = $old_php; + } + return 'PASSED'; + } + + } else { + $wanted = trim($section_text['EXPECT']); + $wanted = preg_replace('/\r\n/',"\n",$wanted); + // compare and leave on success + $ok = (0 == strcmp($output,$wanted)); + if ($ok) { + @unlink($tmp_file); + echo "PASS $tested$info\n"; + if (isset($old_php)) { + $php = $old_php; + } + return 'PASSED'; + } + } + + // Test failed so we need to report details. + if ($warn) { + echo "WARN $tested$info\n"; + } else { + echo "FAIL $tested$info\n"; + } + + $GLOBALS['__PHP_FAILED_TESTS__'][] = array( + 'name' => $file, + 'test_name' => $tested, + 'output' => @ereg_replace('\.phpt$','.log', $file), + 'diff' => @ereg_replace('\.phpt$','.diff', $file), + 'info' => $info + ); + + // write .exp + if (strpos($log_format,'E') !== FALSE) { + $logname = @ereg_replace('\.phpt$','.exp',$file); + $log = fopen($logname,'w') or error("Cannot create test log - $logname"); + fwrite($log,$wanted); + fclose($log); + } + + // write .out + if (strpos($log_format,'O') !== FALSE) { + $logname = @ereg_replace('\.phpt$','.out',$file); + $log = fopen($logname,'w') or error("Cannot create test log - $logname"); + fwrite($log,$output); + fclose($log); + } + + // write .diff + if (strpos($log_format,'D') !== FALSE) { + $logname = @ereg_replace('\.phpt$','.diff',$file); + $log = fopen($logname,'w') or error("Cannot create test log - $logname"); + fwrite($log,generate_diff($wanted,$output)); + fclose($log); + } + + // write .log + if (strpos($log_format,'L') !== FALSE) { + $logname = @ereg_replace('\.phpt$','.log',$file); + $log = fopen($logname,'w') or error("Cannot create test log - $logname"); + fwrite($log," +---- EXPECTED OUTPUT +$wanted +---- ACTUAL OUTPUT +$output +---- FAILED +"); + fclose($log); + error_report($file,$logname,$tested); + } + + if (isset($old_php)) { + $php = $old_php; + } + + return $warn ? 'WARNED' : 'FAILED'; +} + +function generate_diff($wanted,$output) +{ + $w = explode("\n", $wanted); + $o = explode("\n", $output); + $w1 = array_diff_assoc($w,$o); + $o1 = array_diff_assoc($o,$w); + $w2 = array(); + $o2 = array(); + foreach($w1 as $idx => $val) $w2[sprintf("%03d<",$idx)] = sprintf("%03d- ", $idx+1).$val; + foreach($o1 as $idx => $val) $o2[sprintf("%03d>",$idx)] = sprintf("%03d+ ", $idx+1).$val; + $diff = array_merge($w2, $o2); + ksort($diff); + return implode("\r\n", $diff); +} + +function error($message) +{ + echo "ERROR: {$message}\n"; + exit(1); +} + +function settings2array($settings, &$ini_settings) +{ + foreach($settings as $setting) { + if (strpos($setting, '=')!==false) { + $setting = explode("=", $setting, 2); + $name = trim(strtolower($setting[0])); + $value = trim($setting[1]); + $ini_settings[$name] = $value; + } + } +} + +function settings2params(&$ini_settings) +{ + if (count($ini_settings)) { + $settings = ''; + foreach($ini_settings as $name => $value) { + $value = addslashes($value); + $settings .= " -d \"$name=$value\""; + } + $ini_settings = $settings; + } else { + $ini_settings = ''; + } +} + +function settings2paramsnoquotes(&$ini_settings) +{ + if (count($ini_settings)) { + $settings = ''; + foreach($ini_settings as $name => $value) { + $value = addslashes($value); + $settings .= " -d $name=$value"; + } + $ini_settings = $settings; + } else { + $ini_settings = ''; + } +} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: fdm=marker + * vim: noet sw=4 ts=4 + */ +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/lib/tests-config php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/lib/tests-config --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/lib/tests-config 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/lib/tests-config 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,77 @@ + NULL, + +/* executable that will be tested. Not used for + web based tests */ +//'TEST_PHP_EXECUTABLE' => '/usr/bin/php', +'TEST_PHP_EXECUTABLE' => '/usr/bin/php', +/* 'TEST_PHP_EXECUTABLE' => 'c:\Programas\php\php.exe', */ + +/* php.ini to use when executing php */ +'PHPRC' => NULL, + +/* log format */ +'TEST_PHP_LOG_FORMAT' => 'LEODC', + +/* debugging detail in output. */ +'TEST_PHP_DETAILED' => 0, + +/* error style for editors or IDE's */ +'TEST_PHP_ERROR_STYLE' => 'EMACS', + +'REPORT_EXIT_STATUS' => 1, +'NO_PHPTEST_SUMMARY' => 0, + +/* don't ask, and don't send results to QA if true */ +'NO_INTERACTION' => true, + +/* base url prefixed to any requests */ +'TEST_WEB_BASE_URL' => NULL, + +/* if set, copy phpt files into this directory, + which should be accessable via an http server. The + TEST_WEB_BASE_URL setting should be the base url + to access this path. If this is not used, + TEST_WEB_BASE_URL should be the base url pointing + to TEST_PHP_SRCDIR, which should then be accessable via + an http server. + + An example would be: + TEST_WEB_BASE_URL=http://localhost/test + TEST_BASE_PATH=/path/to/htdocs/test +*/ +'TEST_BASE_PATH' => NULL, + +/* file extension of pages requested via http + this allows for php to be configured to parse + extensions other than php, usefull for multiple + configurations under a single webserver */ +'TEST_WEB_EXT' => 'php', + +/* if true doesn't run tests, just outputs executable info */ +'TEST_CONTEXT_INFO' => false, + +/* : or ; seperated list of paths */ +'TEST_PATHS' => 'XML_RPC2', +/* 'TEST_PATHS' => 'xmlrpciBackend' */ +/* additional configuration items that may be set + to provide proxy support for testes: + timeout + proxy_host + proxy_port + proxy_user + proxy_pass +*/ +); + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/Makefile php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/Makefile --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/Makefile 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,9 @@ +run-tests: + php lib/run-tests .. + +clean: + find . -name \*.diff | xargs rm -f + find . -name \*.exp | xargs rm -f + find . -name \*.log | xargs rm -f + find . -name \*.out | xargs rm -f + find . -name \*.php | xargs rm -f diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 1) +--SKIPIF-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', $arg); + +?> +--EXPECT-- +CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! +int(19) +CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 2) +--SKIPIF-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false, + 'cachedMethods' => array('foo', 'bar', 'easyStructTest', 'foo2', 'bar2') + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,47 @@ +--TEST-- +PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 1) +--SKIPIF-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +PHP Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 2) +--SKIPIF-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true, + 'notCachedMethods' => array('foo', 'bar', 'easyStructTest', 'foobar') + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! +int(19) +CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 3) +--SKIPIF-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 1, + 'cacheByDefault' => true, + 'cachedMethods' => array( + 'foo' => 1, + 'bar' => 2, + 'easyStructTest' => 60 + ) + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +sleep(3); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 4) +--SKIPIF-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true, + 'cachedMethods' => array( + 'foo' => 30, + 'bar' => 10, + 'easyStructTest' => -1, + 'foobar' => 60 + ) + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : called method has a -1 lifetime value => no cache ! +int(19) +CACHE DEBUG : called method has a -1 lifetime value => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedClient/tmpdir.inc 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,64 @@ + + * to avoid an extra dependency for a single function. + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.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. + */ + +require_once('PEAR.php'); +define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); + +/** + * Returns the temp directory according to either the TMP, TMPDIR, or + * TEMP env variables. If these are not set it will also check for the + * existence of /tmp, %WINDIR%\temp + * + * @static + * @access public + * @return string The system tmp directory + */ +function tmpDir() +{ + if (FILE_WIN32) { + if (isset($_ENV['TEMP'])) { + return $_ENV['TEMP']; + } + if (isset($_ENV['TMP'])) { + return $_ENV['TMP']; + } + if (isset($_ENV['windir'])) { + return $_ENV['windir'] . '\\temp'; + } + if (isset($_ENV['SystemRoot'])) { + return $_ENV['SystemRoot'] . '\\temp'; + } + if (isset($_SERVER['TEMP'])) { + return $_SERVER['TEMP']; + } + if (isset($_SERVER['TMP'])) { + return $_SERVER['TMP']; + } + if (isset($_SERVER['windir'])) { + return $_SERVER['windir'] . '\\temp'; + } + if (isset($_SERVER['SystemRoot'])) { + return $_SERVER['SystemRoot'] . '\\temp'; + } + return '\temp'; + } + if (isset($_ENV['TMPDIR'])) { + return $_ENV['TMPDIR']; + } + if (isset($_SERVER['TMPDIR'])) { + return $_SERVER['TMPDIR']; + } + return '/tmp'; +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/tmpdir.inc 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,64 @@ + + * to avoid an extra dependency for a single function. + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.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. + */ + +require_once('PEAR.php'); +define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); + +/** + * Returns the temp directory according to either the TMP, TMPDIR, or + * TEMP env variables. If these are not set it will also check for the + * existence of /tmp, %WINDIR%\temp + * + * @static + * @access public + * @return string The system tmp directory + */ +function tmpDir() +{ + if (FILE_WIN32) { + if (isset($_ENV['TEMP'])) { + return $_ENV['TEMP']; + } + if (isset($_ENV['TMP'])) { + return $_ENV['TMP']; + } + if (isset($_ENV['windir'])) { + return $_ENV['windir'] . '\\temp'; + } + if (isset($_ENV['SystemRoot'])) { + return $_ENV['SystemRoot'] . '\\temp'; + } + if (isset($_SERVER['TEMP'])) { + return $_SERVER['TEMP']; + } + if (isset($_SERVER['TMP'])) { + return $_SERVER['TMP']; + } + if (isset($_SERVER['windir'])) { + return $_SERVER['windir'] . '\\temp'; + } + if (isset($_SERVER['SystemRoot'])) { + return $_SERVER['SystemRoot'] . '\\temp'; + } + return '\temp'; + } + if (isset($_ENV['TMPDIR'])) { + return $_ENV['TMPDIR']; + } + if (isset($_SERVER['TMPDIR'])) { + return $_SERVER['TMPDIR']; + } + return '/tmp'; +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,85 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 1) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,94 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 2) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,94 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 3) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,92 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 1) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,86 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 2) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,86 @@ +--TEST-- +PHP Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 3) +--FILE-- + 'validator1.', + 'backend' => 'Php', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/faultFromPython.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +PHP Backend XML-RPC client against python server returning fault response +--SKIPIF-- + +--FILE-- +invalidMethod('World'); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECT-- +string(60) "exceptions.Exception:method "invalidMethod" is not supported" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/okFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/okFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/okFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/okFromPython.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +PHP Backend XML-RPC client against python server returning normal response +--SKIPIF-- + +--FILE-- +echo('World')); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (arrayOfStructsTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 + ), + array( + 'moe' => 5, + 'larry' => 2, + 'curly' => 4 + ), + array( + 'moe' => 0, + 'larry' => 1, + 'curly' => 12 + ) +); +$result = $client->arrayOfStructsTest($arg); +var_dump($result); + +?> +--EXPECT-- +int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,34 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (countTheEntities) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$string = "foo <<< bar '> && '' #fo>o \" bar"; +$result = $client->countTheEntities($string); +var_dump($result['ctLeftAngleBrackets']); +var_dump($result['ctRightAngleBrackets']); +var_dump($result['ctAmpersands']); +var_dump($result['ctApostrophes']); +var_dump($result['ctQuotes']); + + +?> +--EXPECT-- +int(3) +int(2) +int(2) +int(3) +int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (easyStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); + +?> +--EXPECT-- +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (echoStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->echoStructTest($arg); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["moe"]=> + int(5) + ["larry"]=> + int(6) + ["curly"]=> + int(8) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,45 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (manyTypesTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$tmp = "20060116T19:14:03"; +$time = XML_RPC2_Value::createFromNative($tmp, 'datetime'); +$base64 = XML_RPC2_Value::createFromNative('foobar', 'base64'); +$result = $client->manyTypesTest(1, true, 'foo', 3.14159, $time, $base64); +var_dump($result[0]); +var_dump($result[1]); +var_dump($result[2]); +var_dump($result[3]); +var_dump($result[4]->scalar); +var_dump($result[4]->xmlrpc_type); +var_dump($result[4]->timestamp); +var_dump($result[5]->scalar); +var_dump($result[5]->xmlrpc_type); + +?> +--EXPECT-- +int(1) +bool(true) +string(3) "foo" +float(3.14159) +string(17) "20060116T19:14:03" +string(8) "datetime" +int(1137438843) +string(6) "foobar" +string(6) "base64" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (moderateSizeArrayCheck) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$tmp = array('foo'); +for ($i = 0 ; $i<150 ; $i++) { + $tmp[] = "bla bla bla"; +} +$tmp[] = "bar"; +$result = $client->moderateSizeArrayCheck($tmp); +echo($result . "\n"); + +?> +--EXPECT-- +foobar diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (nestedStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); + +$year1999 = array( + '04' => array() +); +$year2001 = $year1999; +$year2000 = $year1999; +$year2000['04']['01'] = array( + 'moe' => 12, + 'larry' => 14, + 'curly' => 9 +); + +$index1999 = '1999 '; +$index2000 = '2000 '; +$index2001 = '2001 '; +$cal = array(); +$cal['1999'] = $year1999; +$cal['2000'] = $year2000; +$cal['2001'] = $year2001; + +require_once('XML/RPC2/Value.php'); +$cal = XML_RPC2_Value::createFromNative($cal, 'struct'); +$result = $client->nestedStructTest($cal); +var_dump($result); + +?> +--EXPECT-- +int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +PHP Backend XML-RPC client against phpxmlrpc validator1 (simpleStructReturnTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Php', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$result = $client->simpleStructReturnTest(13); +var_dump($result['times10']); +var_dump($result['times100']); +var_dump($result['times1000']); + +?> +--EXPECT-- +int(130) +int(1300) +int(13000) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/protocolError.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/protocolError.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/protocolError.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/client/protocolError.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,23 @@ +--TEST-- +PHP Backend XML-RPC client with transport error +--SKIPIF-- + +--FILE-- +invalidMethod('World'); +} catch (XML_RPC2_CurlException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECTREGEX-- +string\(.*\) \"HTTP_Request2_ConnectionException.* diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/array.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/array.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/array.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/array.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,17 @@ +--TEST-- +Array XML-RPC decoding (Php Backend) +--FILE-- +11a'))->getNativeValue()); +?> +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + bool(true) + [2]=> + string(1) "a" +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/base64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/base64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/base64.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/base64.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,13 @@ +--TEST-- +Base64 XML-RPC decoding (Php Backend) +--FILE-- +VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c='))->getNativeValue(); +var_dump($result->xmlrpc_type); +var_dump($result->scalar); +?> +--EXPECT-- +string(6) "base64" +string(44) "The quick brown fox jumped over the lazy dog" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/boolean.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/boolean.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/boolean.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/boolean.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,12 @@ +--TEST-- +Boolean XML-RPC decoding (Php Backend) +--FILE-- +0'))->getNativeValue() ? 'true' : 'false'); +printf("Native value: %s\n", XML_RPC2_Backend_Php_Value::createFromDecode(simplexml_load_string('1'))->getNativeValue() ? 'true' : 'false'); +?> +--EXPECT-- +Native value: false +Native value: true diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/datetime.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/datetime.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/datetime.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/datetime.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,17 @@ +--TEST-- +Datetime XML-RPC decoding (Php Backend) +--FILE-- +2005'))->getNativeValue(); +var_dump($result->xmlrpc_type); +var_dump($result->scalar); +var_dump($result->timestamp); + +?> +--EXPECT-- +string(8) "datetime" +string(4) "2005" +int(1104537600) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/double.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/double.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/double.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/double.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,10 @@ +--TEST-- +Double XML-RPC decoding (Php Backend) +--FILE-- +1.25'))->getNativeValue()); +?> +--EXPECT-- +Native value: 1.25 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/faultResponse.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Response XML-RPC decoding (Php Backend) +--FILE-- + + + + +faultStringFailed to create homedir with: 0 +faultCode200 + + + +XMLMARKER +))); +} catch (Exception $e) { + var_dump($e->getMessage()); +} +?> +--EXPECT-- +string(32) "Failed to create homedir with: 0" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,10 @@ +--TEST-- +Integer XML-RPC decoding (Php Backend) +--FILE-- +7'))->getNativeValue()); +?> +--EXPECT-- +Native value: 7 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer64.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer64.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +Integer XML-RPC decoding (Php Backend) +--SKIPIF-- + +--FILE-- +34359738368'))->getNativeValue()); +?> +--EXPECT-- +Native value: 34359738368 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/integer.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,10 @@ +--TEST-- +Integer XML-RPC decoding (Php Backend) +--FILE-- +13'))->getNativeValue()); +?> +--EXPECT-- +Native value: 13 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/null.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/null.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/null.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/null.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,12 @@ +--TEST-- +Integer XML-RPC decoding (Php Backend) +--FILE-- +'))->getNativeValue(); + +printf("Native value: %s\n", is_null($value) ? 'null' : 'not null'); +?> +--EXPECT-- +Native value: null diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/request.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/request.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/request.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/request.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +Request XML-RPC decoding (Php Backend) +--FILE-- +foo.bara string125125.21997071619203010')); +var_dump($request->getMethodName()); +$result = ($request->getParameters()); +var_dump($result[0]); +var_dump($result[1]); +var_dump($result[2]); +var_dump($result[3]->timestamp); +var_dump($result[3]->xmlrpc_type); +var_dump($result[3]->scalar); +var_dump($result[4]); +var_dump($result[5]); + +?> +--EXPECT-- +string(7) "foo.bar" +string(8) "a string" +int(125) +float(125.2) +int(869011200) +string(8) "datetime" +string(14) "19970716192030" +bool(true) +bool(false) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/response.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/response.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/response.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/response.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,10 @@ +--TEST-- +Response XML-RPC decoding (Php Backend) +--FILE-- +South Dakota'))); +?> +--EXPECT-- +string(12) "South Dakota" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/string.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/string.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/string.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/string.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,12 @@ +--TEST-- +String XML-RPC decoding (Php Backend) +--FILE-- +The quick brown fox jumped over the lazy dog'))->getNativeValue()); +printf("Native value: %s\n", XML_RPC2_Backend_Php_Value::createFromDecode(simplexml_load_string('The quick brown fox jumped over the lazy dog'))->getNativeValue()); +?> +--EXPECT-- +Native value: The quick brown fox jumped over the lazy dog +Native value: The quick brown fox jumped over the lazy dog diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/struct.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/struct.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/struct.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/decoding/struct.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,17 @@ +--TEST-- +Struct XML-RPC decoding (Php Backend) +--FILE-- +a1b1ca string'))->getNativeValue()); +?> +--EXPECT-- +array(3) { + ["a"]=> + int(1) + ["b"]=> + bool(true) + ["c"]=> + string(8) "a string" +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/array.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/array.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/array.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/array.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Array XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(130) "11a string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/base64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/base64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/base64.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/base64.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +Base64 XML-RPC encoding (Php Backend) +--FILE-- +encode()); +$string = new XML_RPC2_Backend_Php_Value_Base64('The brown fox jumped over the lazy dog'); +var_dump($string->encode()); +?> +--EXPECT-- +string(77) "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c=" +string(81) "VGhlIDxxdWljaz4gYnJvd24gZm94IGp1bXBlZCBvdmVyIHRoZSBsYXp5IGRvZw==" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/boolean.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/boolean.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/boolean.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/boolean.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +Boolean XML-RPC encoding (Php Backend) +--FILE-- +encode()); +$bool = new XML_RPC2_Backend_Php_Value_Boolean(false); +var_dump($bool->encode()); +?> +--EXPECT-- +string(20) "1" +string(20) "0" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Datetime XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(65) "1997-01-16T19:20:30.45+01:00" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Datetime XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(60) "1997-01-16T19:20:30.45Z" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Datetime XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(41) "2001" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime4.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Datetime XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(47) "1997-01-16" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/datetime.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,12 @@ +--TEST-- +Datetime XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(54) "19970116T18:20:30" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/double.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/double.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/double.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/double.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +Double XML-RPC encoding (Php Backend) +--FILE-- +encode()); +$double = new XML_RPC2_Backend_Php_Value_Double(123.79); +var_dump($double->encode()); +?> +--EXPECT-- +string(18) "0" +string(23) "123.79" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer64.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer64.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer64.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer64.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,15 @@ +--TEST-- +Integer XML-RPC encoding (Php Backend) +--SKIPIF-- + +--FILE-- +encode()); +?> +--EXPECT-- +string(20) "34359738368" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/integer.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Integer XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(13) "53" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/null.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/null.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/null.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/null.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Nil XML-RPC encoding (Php Backend) +--FILE-- +encode()); +?> +--EXPECT-- +string(11) "" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/request.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/request.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/request.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/request.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,19 @@ +--TEST-- +Request XML-RPC encoding (Php Backend) +--FILE-- +addParameter('a string'); +$request->addParameter(125); +$request->addParameter(125.2); +$request->addParameter(new XML_RPC2_Backend_Php_Value_Datetime('2005-01-03')); +$request->addParameter(true); +$request->addParameter(false); +var_dump($request->encode()); +?> +--EXPECT-- +string(441) " +foo.bara string125125.22005-01-0310" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Request XML-RPC encoding (Php Backend) +--FILE-- + +--EXPECT-- +string(272) " +faultCode2faultStringA fault string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/response.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Request XML-RPC encoding (Php Backend) +--FILE-- + +--EXPECT-- +string(249) " +11a string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/string.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/string.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/string.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/string.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +String XML-RPC encoding (Php Backend) +--FILE-- +encode()); +$string = new XML_RPC2_Backend_Php_Value_String('The brown fox jumped over the lazy dog'); +var_dump($string->encode()); +?> +--EXPECT-- +string(61) "The quick brown fox jumped over the lazy dog" +string(69) "The <quick> brown fox jumped over the lazy dog" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/struct.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/struct.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/struct.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/encoding/struct.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,11 @@ +--TEST-- +Struct XML-RPC encoding (Php Backend) +--FILE-- + 1, 'b' => true, 'c' => 'a string')); +var_dump($struct->encode()); +?> +--EXPECT-- +string(212) "a1b1ca string" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/regressions/11135.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/regressions/11135.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/regressions/11135.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/regressions/11135.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Regression guard against bug 11135: Empty array should not trigger notice +--FILE-- +createFromNative(array()); +} + +?> +--EXPECT-- diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/invalidXMLRequest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +PHP Backend XML-RPC server with non-existant method response +--FILE-- + + + echoecho + World + +EOS +; +$response = $server->getResponse(); +try { + XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECT-- +string(27) "Unable to parse request XML" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/nonexistantMethod.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +PHP Backend XML-RPC server with non-existant method response +--FILE-- + + + example + World + +EOS +; +$response = $server->getResponse(); +try { + XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getFaultCode()); + var_dump($e->getMessage()); +} +?> +--EXPECT-- +int(-32601) +string(40) "server error. requested method not found" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,35 @@ +--TEST-- +PHP Backend XML-RPC server with normal response +--FILE-- + + + echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +PHP Backend XML-RPC server with normal response (with prefix in phpdoc) +--FILE-- + + + prefixed.echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" \ No newline at end of file diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/normalRequestWithPrefix.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,35 @@ +--TEST-- +PHP Backend XML-RPC server with normal response (with prefix) +--FILE-- + 'prefixed.')); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + + prefixed.echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ArrayOfStructsTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,120 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (arrayOfStructsTest) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.arrayOfStructsTest + + + + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + + moe + + 5 + + + + larry + + 2 + + + + curly + + 4 + + + + + + + + moe + + 0 + + + + larry + + 1 + + + + curly + + 12 + + + + + + + + + + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1CountTheEntities.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,66 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (countTheEntities) +--FILE-- +'); + $ctAmpersands = substr_count($string, '&'); + $ctApostrophes = substr_count($string, "'"); + $ctQuotes = substr_count($string, '"'); + return array( + 'ctLeftAngleBrackets' => $ctLeftAngleBrackets, + 'ctRightAngleBrackets' => $ctRightAngleBrackets, + 'ctAmpersands' => $ctAmpersands, + 'ctApostrophes' => $ctApostrophes, + 'ctQuotes' => $ctQuotes + ); + } +} + +set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); +require_once 'XML/RPC2/Server.php'; +$options = array( + 'prefix' => 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.countTheEntities + + + + foo <<< bar '> && '' #fo>o " bar + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result['ctLeftAngleBrackets']); +var_dump($result['ctRightAngleBrackets']); +var_dump($result['ctAmpersands']); +var_dump($result['ctApostrophes']); +var_dump($result['ctQuotes']); + +?> +--EXPECT-- +int(3) +int(2) +int(2) +int(3) +int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EasyStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,66 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (easyStructTest) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1EchoStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,73 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (echoStructTest) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.echoStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["moe"]=> + int(5) + ["larry"]=> + int(6) + ["curly"]=> + int(8) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ManyTypesTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,94 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (manyTypesTest) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.manyTypesTest + + + + 1 + + + + + 1 + + + + + foo + + + + + 3.141590 + + + + + 20060116T19:14:03 + + + + + Zm9vYmFy + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result[0]); +var_dump($result[1]); +var_dump($result[2]); +var_dump($result[3]); +var_dump($result[4]->xmlrpc_type); +var_dump($result[4]->scalar); +var_dump($result[4]->timestamp); +var_dump($result[5]->xmlrpc_type); +var_dump($result[5]->scalar); + +?> +--EXPECT-- +int(1) +bool(true) +string(3) "foo" +float(3.14159) +string(8) "datetime" +string(17) "20060116T19:14:03" +int(1137438843) +string(6) "base64" +string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1ModerateSizeArrayCheck.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,506 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (moderateSizeArrayCheck) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.moderateSizeArrayCheck + + + + + + + foo + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bar + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1NestedStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,131 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (nestedStructTest) +--FILE-- + 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.nestedStructTest + + + + + + 1999 + + + + 04 + + + + + + + + + + + 2000 + + + + 04 + + + + 01 + + + + moe + + 12 + + + + larry + + 14 + + + + curly + + 9 + + + + + + + + + + + + + 2001 + + + + 04 + + + + + + + + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/phpBackend/server/validator1SimpleStructReturnTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,58 @@ +--TEST-- +PHP Backend XML-RPC server Validator1 test (simpleStructReturnTest) +--FILE-- + 10 * $int, + 'times100' => 100 * $int, + 'times1000' => 1000 * $int + ); + } +} + +set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); +require_once 'XML/RPC2/Server.php'; +$options = array( + 'prefix' => 'validator1.', + 'backend' => 'Php' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.simpleStructReturnTest + + + + 13 + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["times10"]=> + int(130) + ["times100"]=> + int(1300) + ["times1000"]=> + int(13000) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/11314.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/11314.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/11314.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/11314.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,105 @@ +--TEST-- +Bug #11314: Following codesniffer standards param docs mess up +--FILE-- + + + * @copyright 2007 Lars Olesen + * @license GPL http://www.opensource.org/licenses/gpl-license.php + * @version @package-version@ + * @link http://pear.php.net/package/XML_RPC2 + */ +require_once 'XML/RPC2/Server.php'; + +/** + * The implementation + * + * @category XML + * @package XML_RPC2 + * @author Lars Olesen + * @copyright 2007 Lars Olesen + * @license GPL http://www.opensource.org/licenses/gpl-license.php + * @version @package-version@ + * @link http://pear.php.net/package/XML_RPC2 + */ +class DocumentationServer { + + /** + * returns something + * + * @param array $something A description + * @param string $another_thing A description of another thing + * @param boolean $return Whether to return nothing - server doesn't care though + * + * @return string An international string + */ + public static function getSomething($something, $another_thing, $credentials) { + return 'nothing interesting'; + } + +} + +$options = array( + 'prefix' => 'test.', + 'encoding' => 'utf-8' +); + +$server = XML_RPC2_Server::create('DocumentationServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = ''; +$server->handleCall(); +?> +--EXPECT-- + + + + + Available XMLRPC methods for this server + + + +

Available XMLRPC methods for this server

+

Index

+ +

Details

+
+

(string) test.getSomething((array) something, (string) another_thing, (boolean) credentials)

+

Description :

+
+ returns something +
+

Parameters :

+ + + + + +
TypeNameDocumentation
arraysomethingA description
stringanother_thingA description of another thing
booleancredentialsWhether to return nothing - server doesn't care though
+

(return to index)

+
+ + diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/14038.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/14038.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/14038.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/14038.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Empty array should not trigger notice +--FILE-- +createFromNative(array()); +} +--EXPECT-- diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/18258.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/18258.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/18258.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/regressions/18258.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,40 @@ +--TEST-- +Request #18258 Can not call remote function called create() because XML_RPC2_Client::create() +--FILE-- + 'test.', + 'encoding' => 'utf-8' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$request = new XML_RPC2_Backend_Php_Request('test.create'); +$request->addParameter(12); +$GLOBALS['HTTP_RAW_POST_DATA'] = $request->encode(); +$server->handleCall(); +?> +--EXPECT-- + +12 diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,47 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 1) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', $arg); + +?> +--EXPECT-- +CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! +int(19) +CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOffByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,55 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache off by default 2) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => $dir, + 'lifetime' => 60, + 'cacheByDefault' => false, + 'cachedMethods' => array('foo', 'bar', 'easyStructTest', 'foo2', 'bar2') + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); +@rmdir($dir); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,54 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 1) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => $dir, + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); +@rmdir($dir); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 2) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true, + 'notCachedMethods' => array('foo', 'bar', 'easyStructTest', 'foobar') + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! +int(19) +CACHE DEBUG : the called method is listed in _notCachedMethods => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,56 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 3) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => $dir, + 'lifetime' => 1, + 'cacheByDefault' => true, + 'cachedMethods' => array( + 'foo' => 1, + 'bar' => 2, + 'easyStructTest' => 60 + ) + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +sleep(3); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); +@rmdir($dir); + +?> +--EXPECT-- +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/phpxmlrpcValidator1EasyStructTestCacheOnByDefault4.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,53 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedClient against phpxmlrpc validator1 (easyStructTest with cache on by default 4) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true, + 'cachedMethods' => array( + 'foo' => 30, + 'bar' => 10, + 'easyStructTest' => -1, + 'foobar' => 60 + ) + ), + 'cacheDebug' => true +); + +$client = XML_RPC2_CachedClient::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); +$result = $client->easyStructTest($arg); +var_dump($result); +$client->dropCacheFile___('easyStructTest', array($arg)); + +?> +--EXPECT-- +CACHE DEBUG : called method has a -1 lifetime value => no cache ! +int(19) +CACHE DEBUG : called method has a -1 lifetime value => no cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedClient/tmpdir.inc 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,64 @@ + + * to avoid an extra dependency for a single function. + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.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. + */ + +require_once('PEAR.php'); +define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); + +/** + * Returns the temp directory according to either the TMP, TMPDIR, or + * TEMP env variables. If these are not set it will also check for the + * existence of /tmp, %WINDIR%\temp + * + * @static + * @access public + * @return string The system tmp directory + */ +function tmpDir() +{ + if (FILE_WIN32) { + if (isset($_ENV['TEMP'])) { + return $_ENV['TEMP']; + } + if (isset($_ENV['TMP'])) { + return $_ENV['TMP']; + } + if (isset($_ENV['windir'])) { + return $_ENV['windir'] . '\\temp'; + } + if (isset($_ENV['SystemRoot'])) { + return $_ENV['SystemRoot'] . '\\temp'; + } + if (isset($_SERVER['TEMP'])) { + return $_SERVER['TEMP']; + } + if (isset($_SERVER['TMP'])) { + return $_SERVER['TMP']; + } + if (isset($_SERVER['windir'])) { + return $_SERVER['windir'] . '\\temp'; + } + if (isset($_SERVER['SystemRoot'])) { + return $_SERVER['SystemRoot'] . '\\temp'; + } + return '\temp'; + } + if (isset($_ENV['TMPDIR'])) { + return $_ENV['TMPDIR']; + } + if (isset($_SERVER['TMPDIR'])) { + return $_SERVER['TMPDIR']; + } + return '/tmp'; +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/tmpdir.inc 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,64 @@ + + * to avoid an extra dependency for a single function. + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.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. + */ + +require_once('PEAR.php'); +define('FILE_WIN32', defined('OS_WINDOWS') ? OS_WINDOWS : !strncasecmp(PHP_OS, 'win', 3)); + +/** + * Returns the temp directory according to either the TMP, TMPDIR, or + * TEMP env variables. If these are not set it will also check for the + * existence of /tmp, %WINDIR%\temp + * + * @static + * @access public + * @return string The system tmp directory + */ +function tmpDir() +{ + if (FILE_WIN32) { + if (isset($_ENV['TEMP'])) { + return $_ENV['TEMP']; + } + if (isset($_ENV['TMP'])) { + return $_ENV['TMP']; + } + if (isset($_ENV['windir'])) { + return $_ENV['windir'] . '\\temp'; + } + if (isset($_ENV['SystemRoot'])) { + return $_ENV['SystemRoot'] . '\\temp'; + } + if (isset($_SERVER['TEMP'])) { + return $_SERVER['TEMP']; + } + if (isset($_SERVER['TMP'])) { + return $_SERVER['TMP']; + } + if (isset($_SERVER['windir'])) { + return $_SERVER['windir'] . '\\temp'; + } + if (isset($_SERVER['SystemRoot'])) { + return $_SERVER['SystemRoot'] . '\\temp'; + } + return '\temp'; + } + if (isset($_ENV['TMPDIR'])) { + return $_ENV['TMPDIR']; + } + if (isset($_SERVER['TMPDIR'])) { + return $_SERVER['TMPDIR']; + } + return '/tmp'; +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,91 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 1) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,100 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 2) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOffByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,100 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache off by default 3) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => false + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=false, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=30 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault1.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,98 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 1) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is not hit ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=true, lifetime=60 +CACHE DEBUG : cache is hit ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault2.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,92 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 2) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=60 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/cachedServer/validator1EasyStructTestCacheOnByDefault3.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,92 @@ +--TEST-- +XMLRPCext Backend XML-RPC cachedServer Validator1 test (easyStructTest with cache on by default 3) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext', + 'cacheOptions' => array( + 'cacheDir' => tmpDir() . '/', + 'lifetime' => 60, + 'cacheByDefault' => true + ), + 'cacheDebug' => true +); + +$server = XML_RPC2_CachedServer::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); +$server->clean(); + +?> +--EXPECT-- +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 +CACHE DEBUG : we don't cache ! +int(19) +CACHE DEBUG : default values => weCache=true, lifetime=60 +CACHE DEBUG : phpdoc comments => weCache=false, lifetime=-1 +CACHE DEBUG : we don't cache ! +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/faultFromPython.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against python server returning fault response +--SKIPIF-- + +--FILE-- +invalidMethod('World'); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECT-- +string(60) "exceptions.Exception:method "invalidMethod" is not supported" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/okFromPython.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against python server returning normal response +--SKIPIF-- + +--FILE-- +echo('World')); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ArrayOfStructsTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (arrayOfStructsTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 + ), + array( + 'moe' => 5, + 'larry' => 2, + 'curly' => 4 + ), + array( + 'moe' => 0, + 'larry' => 1, + 'curly' => 12 + ) +); +$result = $client->arrayOfStructsTest($arg); +var_dump($result); + +?> +--EXPECT-- +int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1CountTheEntities.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (countTheEntities) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$string = "foo <<< bar '> && '' #fo>o \" bar"; +$result = $client->countTheEntities($string); +var_dump($result['ctLeftAngleBrackets']); +var_dump($result['ctRightAngleBrackets']); +var_dump($result['ctAmpersands']); +var_dump($result['ctApostrophes']); +var_dump($result['ctQuotes']); + + +?> +--EXPECT-- +int(3) +int(2) +int(2) +int(3) +int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EasyStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (easyStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->easyStructTest($arg); +var_dump($result); + +?> +--EXPECT-- +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1EchoStructTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (echoStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$arg = array( + 'moe' => 5, + 'larry' => 6, + 'curly' => 8 +); +$result = $client->echoStructTest($arg); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["moe"]=> + int(5) + ["larry"]=> + int(6) + ["curly"]=> + int(8) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ManyTypesTest.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,51 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (manyTypesTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$tmp = "20060116T19:14:03"; +$time = XML_RPC2_Value::createFromNative($tmp, 'datetime'); +$base64 = XML_RPC2_Value::createFromNative('foobar', 'base64'); +$result = $client->manyTypesTest(1, true, 'foo', 3.14159, $time, $base64); +var_dump($result[0]); +var_dump($result[1]); +var_dump($result[2]); +var_dump($result[3]); +var_dump($result[4]->scalar); +var_dump($result[4]->xmlrpc_type); +var_dump($result[4]->timestamp); +var_dump($result[5]->scalar); +var_dump($result[5]->xmlrpc_type); + +?> +--EXPECT-- +int(1) +bool(true) +string(3) "foo" +float(3.14159) +string(17) "20060116T19:14:03" +string(8) "datetime" +int(1137438843) +string(6) "foobar" +string(6) "base64" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1ModerateSizeArrayCheck.phpt 2016-06-21 19:29:55.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (moderateSizeArrayCheck) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$tmp = array('foo'); +for ($i = 0 ; $i<150 ; $i++) { + $tmp[] = "bla bla bla"; +} +$tmp[] = "bar"; +$result = $client->moderateSizeArrayCheck($tmp); +echo($result . "\n"); + +?> +--EXPECT-- +foobar diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1NestedStructTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (nestedStructTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); + +$year1999 = array( + '04' => array() +); +$year2001 = $year1999; +$year2000 = $year1999; +$year2000['04']['01'] = array( + 'moe' => 12, + 'larry' => 14, + 'curly' => 9 +); + +$index1999 = '1999 '; +$index2000 = '2000 '; +$index2001 = '2001 '; +$cal = array(); +$cal['1999'] = $year1999; +$cal['2000'] = $year2000; +$cal['2001'] = $year2001; + +require_once('XML/RPC2/Value.php'); +$cal = XML_RPC2_Value::createFromNative($cal, 'struct'); +$result = $client->nestedStructTest($cal); +var_dump($result); + +?> +--EXPECT-- +int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/phpxmlrpcValidator1SimpleStructReturnTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +XMLRPCext Backend XML-RPC client against phpxmlrpc validator1 (simpleStructReturnTest) +--SKIPIF-- + +--FILE-- + false, + 'backend' => 'Xmlrpcext', + 'prefix' => 'validator1.' +); +$client = XML_RPC2_Client::create('http://phpxmlrpc.sourceforge.net/server.php', $options); +$result = $client->simpleStructReturnTest(13); +var_dump($result['times10']); +var_dump($result['times100']); +var_dump($result['times1000']); + +?> +--EXPECT-- +int(130) +int(1300) +int(13000) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/protocolError.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +XMLRPCext Backend XML-RPC client with transport error +--SKIPIF-- + +--FILE-- +invalidMethod('World'); +} catch (XML_RPC2_CurlException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECTREGEX-- +string\(.*\) \"HTTP_Request2_ConnectionException.* diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/client/valueCreateFromNative.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,23 @@ +--TEST-- +XMLRPCext backend test setting explicit type for value +--SKIPIF-- + +--FILE-- + +--EXPECT-- +object(stdClass)#1 (2) { + ["scalar"]=> + string(11) "Hello World" + ["xmlrpc_type"]=> + string(6) "base64" +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/invalidXMLRequest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,47 @@ +--TEST-- +XMLRPCext Backend XML-RPC server with normal response +--SKIPIF-- + + + moo + World + +EOS +; +try { + $response = $server->getResponse(); + //print($response); + //XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getMessage()); +} +?> +--EXPECT-- +string(36) "server error. method not found. + +moo" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/nonexistantMethod.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +XMLRPCext Backend XML-RPC server with normal response +--SKIPIF-- + +--FILE-- + + + moo + World + +EOS +; +$response = $server->getResponse(); +try { + XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response)); +} catch (XML_RPC2_FaultException $e) { + var_dump($e->getFaultCode()); + var_dump($e->getMessage()); +} + +?> +--EXPECT-- +int(-32601) +string(40) "server error. requested method not found" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +XMLRPCext Backend XML-RPC server with normal response +--SKIPIF-- + +--FILE-- + + + echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix2.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +XMLRPCext Backend XML-RPC server with normal response (with prefix in phpdoc) +--SKIPIF-- + +--FILE-- + + + prefixed.echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/normalRequestWithPrefix.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +XMLRPCext Backend XML-RPC server with normal response (with prefix) +--SKIPIF-- + +--FILE-- + 'prefixed.')); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + + prefixed.echoecho + World + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +string(5) "World" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ArrayOfStructsTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,126 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (arrayOfStructsTest) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.arrayOfStructsTest + + + + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + + moe + + 5 + + + + larry + + 2 + + + + curly + + 4 + + + + + + + + moe + + 0 + + + + larry + + 1 + + + + curly + + 12 + + + + + + + + + + +EOS +; +$response = $server->getResponse(); +var_dump(XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +?> +--EXPECT-- +int(24) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1CountTheEntities.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,72 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (countTheEntities) +--SKIPIF-- + +--FILE-- +'); + $ctAmpersands = substr_count($string, '&'); + $ctApostrophes = substr_count($string, "'"); + $ctQuotes = substr_count($string, '"'); + return array( + 'ctLeftAngleBrackets' => $ctLeftAngleBrackets, + 'ctRightAngleBrackets' => $ctRightAngleBrackets, + 'ctAmpersands' => $ctAmpersands, + 'ctApostrophes' => $ctApostrophes, + 'ctQuotes' => $ctQuotes + ); + } +} + +set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); +require_once 'XML/RPC2/Server.php'; +$options = array( + 'prefix' => 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.countTheEntities + + + + foo <<< bar '> && '' #fo>o " bar + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result['ctLeftAngleBrackets']); +var_dump($result['ctRightAngleBrackets']); +var_dump($result['ctAmpersands']); +var_dump($result['ctApostrophes']); +var_dump($result['ctQuotes']); + +?> +--EXPECT-- +int(3) +int(2) +int(2) +int(3) +int(1) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EasyStructTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,72 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (easyStructTest) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.easyStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +int(19) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1EchoStructTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,79 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (echoStructTest) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.echoStructTest + + + + + + moe + + 5 + + + + larry + + 6 + + + + curly + + 8 + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["moe"]=> + int(5) + ["larry"]=> + int(6) + ["curly"]=> + int(8) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ManyTypesTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,100 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (manyTypesTest) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.manyTypesTest + + + + 1 + + + + + 1 + + + + + foo + + + + + 3.141590 + + + + + 20060116T19:14:03 + + + + + Zm9vYmFy + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result[0]); +var_dump($result[1]); +var_dump($result[2]); +var_dump($result[3]); +var_dump($result[4]->xmlrpc_type); +var_dump($result[4]->scalar); +var_dump($result[4]->timestamp); +var_dump($result[5]->xmlrpc_type); +var_dump($result[5]->scalar); + +?> +--EXPECT-- +int(1) +bool(true) +string(3) "foo" +float(3.14159) +string(8) "datetime" +string(17) "20060116T19:14:03" +int(1137438843) +string(6) "base64" +string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1ModerateSizeArrayCheck.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,512 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (moderateSizeArrayCheck) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.moderateSizeArrayCheck + + + + + + + foo + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bla bla bla + + + bar + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +string(6) "foobar" diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1NestedStructTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,137 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (nestedStructTest) +--SKIPIF-- + +--FILE-- + 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.nestedStructTest + + + + + + 1999 + + + + 04 + + + + + + + + + + + 2000 + + + + 04 + + + + 01 + + + + moe + + 12 + + + + larry + + 14 + + + + curly + + 9 + + + + + + + + + + + + + 2001 + + + + 04 + + + + + + + + + + + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +int(35) diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/tests/XML_RPC2/xmlrpcextBackend/server/validator1SimpleStructReturnTest.phpt 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,64 @@ +--TEST-- +XMLRPCext Backend XML-RPC server Validator1 test (simpleStructReturnTest) +--SKIPIF-- + +--FILE-- + 10 * $int, + 'times100' => 100 * $int, + 'times1000' => 1000 * $int + ); + } +} + +set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path()); +require_once 'XML/RPC2/Server.php'; +$options = array( + 'prefix' => 'validator1.', + 'backend' => 'Xmlrpcext' +); + +$server = XML_RPC2_Server::create('TestServer', $options); +$GLOBALS['HTTP_RAW_POST_DATA'] = << + +validator1.simpleStructReturnTest + + + + 13 + + + + +EOS +; +$response = $server->getResponse(); +$result = (XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response))); +var_dump($result); + +?> +--EXPECT-- +array(3) { + ["times10"]=> + int(130) + ["times100"]=> + int(1300) + ["times1000"]=> + int(13000) +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Client.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Client.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,143 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Util/HTTPRequest.php'; +require_once 'XML/RPC2/Value.php'; +require_once 'XML/RPC2/Client.php'; +require_once 'XML/RPC2/Backend/Php/Request.php'; +require_once 'XML/RPC2/Backend/Php/Response.php'; +// }}} + +/** + * XML_RPC client backend class. This is the default, all-php XML_RPC client backend. + * + * This backend does not require the xmlrpc extension to be compiled in. It implements + * XML_RPC based on the always present DOM and SimpleXML PHP5 extensions. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Client extends XML_RPC2_Client +{ + + // {{{ constructor + + /** + * Construct a new XML_RPC2_Client PHP Backend. + * + * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). + * Optionally, some options may be set + * + * @param string URI for the XML-RPC server + * @param array (optional) Associative array of options + */ + public function __construct($uri, $options = array()) + { + parent::__construct($uri, $options); + if ($this->encoding != 'utf-8') throw new XML_RPC2_Exception('XML_RPC2_Backend_Php does not support any encoding other than utf-8, due to a simplexml limitation'); + } + + // }}} + // {{{ __call() + + /** + * __call Catchall. This method catches remote method calls and provides for remote forwarding. + * + * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to + * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value + * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative + * proves inacurate -- as when encoding DateTime values -- you should present an instance of + * XML_RPC_Value in lieu of the native parameter. + * + * @param string Method name + * @param array Parameters + * @return mixed The call result, already decoded into native types + */ + public function __call($methodName, $parameters) + { + $request = new XML_RPC2_Backend_Php_Request($this->prefix . $methodName, $this->encoding); + $request->setParameters($parameters); + $request = $request->encode(); + $uri = $this->uri; + $options = array( + 'encoding' => $this->encoding, + 'proxy' => $this->proxy, + 'sslverify' => $this->sslverify, + 'connectionTimeout' => $this->connectionTimeout + ); + if (isset($this->httpRequest)) $options['httpRequest'] = $this->httpRequest; + $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options); + $httpRequest->setPostData($request); + $httpRequest->sendRequest(); + $body = $httpRequest->getBody(); + if ($this->debug) { + XML_RPC2_ClientHelper::printPreParseDebugInfo($request, $body); + } + try { + $document = new SimpleXMLElement($body); + $result = XML_RPC2_Backend_Php_Response::decode($document); + } catch (XML_RPC2_Exception $e) { + if ($this->debug) { + if (get_class($e)=='XML_RPC2_FaultException') { + print "XML_RPC2_FaultException #" . $e->getFaultCode() . " : " . $e->getMessage(); + } else { + print get_class($e) . " : " . $e->getMessage(); + } + } + throw $e; + } + if ($this->debug) { + XML_RPC2_ClientHelper::printPostRequestDebugInformation($result); + } + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Request.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Request.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Request.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Request.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,205 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value.php'; +// }}} + +/** + * XML_RPC request backend class. This class represents an XML_RPC request, exposing the methods + * needed to encode/decode a request. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Request +{ + // {{{ properties + + /** + * Name of requested method + * + * @var mixed + */ + private $_methodName = ''; + + /** + * request parameters + * + * @var array + */ + private $_parameters = null; + + /** + * encoding of the request + * + * @var string + */ + private $_encoding = 'utf-8'; + + // }}} + // {{{ setParameters() + + /** + * parameters property setter + * + * @param mixed value The new parameters + */ + public function setParameters($value) + { + $this->_parameters = $value; + } + + // }}} + // {{{ addParameter() + + /** + * parameters property appender + * + * @param mixed value The new parameter + */ + public function addParameter($value) + { + $this->_parameters[] = $value; + } + + // }}} + // {{{ getParameters() + + /** + * parameters property getter + * + * @return mixed The current parameters + */ + public function getParameters() + { + return $this->_parameters; + } + + // }}} + // {{{ getMethodName() + + /** + * method name getter + * + * @return string method name + */ + public function getMethodName() + { + return $this->_methodName; + } + + // }}} + // {{{ constructor + + /** + * Create a new xml-rpc request with the provided methodname + * + * @param string Name of method targeted by this xml-rpc request + * @param string encoding of the request + */ + function __construct($methodName, $encoding = 'utf-8') + { + $this->_methodName = $methodName; + $this->setParameters(array()); + $this->_encoding = $encoding; + } + + // }}} + // {{{ encode() + + /** + * Encode the request for transmission. + * + * @return string XML-encoded request (a full XML document) + */ + public function encode() + { + $methodName = $this->_methodName; + $parameters = $this->getParameters(); + + $result = '_encoding . '"?>' . "\n"; + $result .= ""; + $result .= "${methodName}"; + $result .= ""; + foreach($parameters as $parameter) { + $result .= ""; + $result .= ($parameter instanceof XML_RPC2_Backend_Php_Value) ? $parameter->encode() : XML_RPC2_Backend_Php_Value::createFromNative($parameter)->encode(); + $result .= ""; + } + $result .= ""; + $result .= ""; + return $result; + } + + // }}} + // {{{ createFromDecode() + + /** + * Decode a request from XML and construct a request object with the createFromDecoded values + * + * @param SimpleXMLElement The encoded XML-RPC request. + * @return XML_RPC2_Backend_Php_Request The xml-rpc request, represented as an object instance + */ + public static function createFromDecode($simpleXML) + { + $methodName = (string) $simpleXML->methodName; + $params = array(); + foreach ($simpleXML->params->param as $param) { + foreach ($param->value as $value) { + $params[] = XML_RPC2_Backend_Php_Value::createFromDecode($value)->getNativeValue(); + } + } + $result = new XML_RPC2_Backend_Php_Request($methodName); + $result->setParameters($params); + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Response.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Response.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Response.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Response.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,142 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value.php'; +require_once 'XML/RPC2/Backend/Php/Value/Struct.php'; +// }}} + +/** + * XML-RPC response backend class. + * + * This class represents an XML_RPC request, exposing the methods + * needed to encode/decode an xml-rpc response. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Response +{ + + // {{{ encode() + + /** + * Encode a normal XML-RPC response, containing the provided value + * + * You may supply a php-native value, or an XML_RPC2_Backend_Php_Value instance, to be returned. Usually providing a native value + * is more convenient. However, for some types, XML_RPC2_Backend_Php_Value::createFromNative can't properly choose the xml-rpc + * type. In these cases, constructing an XML_RPC2_Backend_Php_Value and using it as param here is the only way to return the desired + * type. + * + * @see http://www.xmlrpc.com/spec + * @see XML_RPC2_Backend_Php_Value::createFromNative + * @param mixed $param The result value which the response will envelop + * @param string $encoding encoding + * @return string The XML payload + */ + public static function encode($param, $encoding = 'utf-8') + { + if (!$param instanceof XML_RPC2_Backend_Php_Value) { + $param = XML_RPC2_Backend_Php_Value::createFromNative($param); + } + $result = '' . "\n"; + $result .= '' . $param->encode() . ''; + return $result; + } + + // }}} + // {{{ encodeFault() + + /** + * Encode a fault XML-RPC response, containing the provided code and message + * + * @see http://www.xmlrpc.com/spec + * @param int $code Response code + * @param string $message Response message + * @param string $encoding encoding + * @return string The XML payload + */ + public static function encodeFault($code, $message, $encoding = 'utf-8') + { + $value = new XML_RPC2_Backend_Php_Value_Struct(array('faultCode' => (int) $code, 'faultString' => (string) $message)); + $result = '' . "\n"; + $result .= '' . $value->encode() . ''; + return $result; + } + + // }}} + // {{{ decode() + + /** + * Parse a response and either return the native PHP result. + * + * This method receives an XML-RPC response document, in SimpleXML format, decodes it and returns the payload value. + * + * @param SimpleXmlElement $xml The Transport XML + * @return mixed The response payload + * + * @see http://www.xmlrpc.com/spec + * @throws XML_RPC2_FaultException Signals the decoded response was an XML-RPC fault + * @throws XML_RPC2_DecodeException Signals an ill formed payload response section + */ + public static function decode(SimpleXMLElement $xml) + { + $faultNode = $xml->xpath('/methodResponse/fault'); + if (count($faultNode) == 1) { + throw XML_RPC2_FaultException::createFromDecode($faultNode[0]); + } + $paramValueNode = $xml->xpath('/methodResponse/params/param/value'); + if (count($paramValueNode) == 1) { + return XML_RPC2_Backend_Php_Value::createFromDecode($paramValueNode[0])->getNativeValue(); + } + throw new XML_RPC2_DecodeException('Unable to decode xml-rpc response. No fault nor params/param elements found'); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Server.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Server.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,148 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Backend/Php/Request.php'; +require_once 'XML/RPC2/Backend/Php/Response.php'; +require_once 'XML/RPC2/Exception.php'; +// }}} + +/** + * XML_RPC server class PHP-only backend. + * + * The XML_RPC2_Server does the work of decoding and encoding xml-rpc request and response. The actual + * method execution is delegated to the call handler instance. + * + * The XML_RPC server is responsible for decoding the request and calling the appropriate method in the + * call handler class. It then encodes the result into an XML-RPC response and returns it to the client. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Server extends XML_RPC2_Server +{ + + // {{{ constructor + + /** + * Create a new XML-RPC Server. + * + * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual + * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client + * + * @param object $callHandler + * @param array $options associative array of options + * @access public + */ + function __construct($callHandler, $options = array()) + { + parent::__construct($callHandler, $options); + if (strtolower($this->encoding) != 'utf-8') { + throw new XML_RPC2_Exception('XML_RPC2_Backend_Php does not support any encoding other than utf-8, due to a simplexml limitation'); + } + } + + // }}} + // {{{ handleCall() + + /** + * Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response. + * + */ + public function handleCall() + { + if ($this->autoDocument && $this->input->isEmpty()) { + $this->autoDocument(); + } else { + $response = $this->getResponse(); + header('Content-type: text/xml; charset=' . strtolower($this->encoding)); + header('Content-length: ' . $this->getContentLength($response)); + print $response; + } + } + + // }}} + // {{{ getResponse() + + /** + * Get the XML response of the XMLRPC server + * + * @return string XML response + */ + public function getResponse() + { + try { + set_error_handler(array('XML_RPC2_Backend_Php_Server', 'errorToException')); + $request = @simplexml_load_string($this->input->readRequest()); + // TODO : do not use exception but a XMLRPC error ! + if (!is_object($request)) throw new XML_RPC2_FaultException('Unable to parse request XML', 0); + $request = XML_RPC2_Backend_Php_Request::createFromDecode($request); + $methodName = $request->getMethodName(); + $arguments = $request->getParameters(); + if ($this->signatureChecking) { + $method = $this->callHandler->getMethod($methodName); + if (!($method)) { + // see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes + return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found')); + } + if (!($method->matchesSignature($methodName, $arguments))) { + return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters')); + } + } + restore_error_handler(); + return (XML_RPC2_Backend_Php_Response::encode(call_user_func_array(array($this->callHandler, $methodName), $arguments), $this->encoding)); + } catch (XML_RPC2_FaultException $e) { + return (XML_RPC2_Backend_Php_Response::encodeFault($e->getFaultCode(), $e->getMessage(), $this->encoding)); + } catch (Exception $e) { + if (ini_get('display_errors') == 1) { + return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage() . $e->getTraceAsString(), $this->encoding)); + } else { + return XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled PHP Exception', $this->encoding); + } + } + } + +} +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Array.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Array.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Array.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Array.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,131 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value.php'; +// }}} + +/** + * XML_RPC array value class. Represents values of type array + * + * @author Sergio Carvalho + * @package XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Array extends XML_RPC2_Backend_Php_Value +{ + + // {{{ setNativeValue() + + /** + * nativeValue property setter + * + * @param mixed value the new nativeValue + */ + protected function setNativeValue($value) + { + if (!is_array($value)) { + throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Value_Array from type \'%s\'.', gettype($nativeValue))); + } + parent::setNativeValue($value); + } + + // }}} + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Array with the given nativeValue + * + * @param mixed nativeValue + */ + public function __construct($nativeValue) + { + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + $result = ''; + foreach($this->getNativeValue() as $element) { + $result .= ''; + $result .= ($element instanceof XML_RPC2_Backend_Php_Value) ? + $element->encode() : + XML_RPC2_Backend_Php_Value::createFromNative($element)->encode(); + $result .= ''; + } + $result .= ''; + return $result; + } + + // }}} + // {{{ decode() + + /** + * Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $values = $xml->xpath('/value/array/data/value'); + $result = array(); + foreach (array_keys($values) as $i) { + $result[] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i])->getNativeValue(); + } + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Base64.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Base64.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Base64.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Base64.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,135 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC base64 value class. Instances of this class represent base64-encoded string scalars in XML_RPC + * + * To work on a compatible way with the xmlrpcext backend, we introduce a particular "nativeValue" which is + * a standard class (stdclass) with two public properties : + * scalar => the string (non encoded) + * xmlrpc_type => 'base64' + * + * The constructor can be called with a "classic" string or with a such object + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Base64 extends XML_RPC2_Backend_Php_Value +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Base64 with the given value + * + * This class handles encoding-decoding internally. Do not provide the + * native string base64-encoded + * + * @param mixed String $nativeValue to be transmited base64-encoded or "stdclass native value" + */ + public function __construct($nativeValue) + { + if ((is_object($nativeValue)) &&(strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { + $scalar = $nativeValue->scalar; + } else { + if (!is_string($nativeValue)) { + throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Base64 from type \'%s\'.', gettype($nativeValue))); + } + $scalar = $nativeValue; + } + $tmp = new stdclass(); + $tmp->scalar = $scalar; + $tmp->xmlrpc_type = 'base64'; + $this->setNativeValue($tmp); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + $native = $this->getNativeValue(); + return '' . base64_encode($native->scalar) . ''; + } + + // }}} + // {{{ decode() + + /** + * Decode transport XML and set the instance value accordingly + * + * @param mixed $xml The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/base64/text()'); + if (!array_key_exists(0, $value)) { + $value = $xml->xpath('/value/text()'); + } + // Emulate xmlrpcext results (to be able to switch from a backend to another) + $result = new stdclass(); + $result->scalar = base64_decode($value[0]); + $result->xmlrpc_type = 'base64'; + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Boolean.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Boolean.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Boolean.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Boolean.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,108 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC boolean value class. Instances of this class represent boolean scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Boolean extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Value_Boolean with the given value + * + * @param mixed value + */ + public function __construct($nativeValue) + { + parent::__construct('boolean', $nativeValue); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + return '' . ($this->getNativeValue() ? 1 : 0). ''; + } + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/boolean/text()'); + + // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 + return (boolean) ((string) $value[0]); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Datetime.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Datetime.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Datetime.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Datetime.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,209 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC datetime value class. Instances of this class represent datetime scalars in XML_RPC + * + * To work on a compatible way with the xmlrpcext backend, we introduce a particular "nativeValue" which is + * a standard class (stdclass) with three public properties : + * scalar => the iso8601 date string + * timestamp => the corresponding timestamp (int) + * xmlrpc_type => 'datetime' + * + * The constructor can be called with a iso8601 string, with a timestamp or with a such object + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Datetime extends XML_RPC2_Backend_Php_Value +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Datetime with the given value + * + * The provided value can be an int, which will be interpreted as a Unix timestamp, or + * a string in iso8601 format, or a "stdclass native value" + * + * @param mixed $nativeValue a timestamp, an iso8601 date or a "stdclass native value" + * @see http://www.w3.org/TR/NOTE-datetime + */ + public function __construct($nativeValue) + { + if ((!is_int($nativeValue)) and (!is_float($nativeValue)) and (!is_string($nativeValue)) and (!is_object($nativeValue))) { + throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Datetime from type \'%s\'.', gettype($nativeValue))); + } + if ((is_object($nativeValue)) &&(strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { + $scalar = $nativeValue->scalar; + $timestamp = $nativeValue->timestamp; + } else { + if ((is_int($nativeValue)) or (is_float($nativeValue))) { + $scalar = XML_RPC2_Backend_Php_Value_Datetime::_timestampToIso8601($nativeValue); + $timestamp = (int) $nativeValue; + } elseif (is_string($nativeValue)) { + $scalar= $nativeValue; + $timestamp = (int) XML_RPC2_Backend_Php_Value_Datetime::_iso8601ToTimestamp($nativeValue); + } else { + throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Datetime from type \'%s\'.', gettype($nativeValue))); + } + } + $tmp = new stdclass(); + $tmp->scalar = $scalar; + $tmp->timestamp = $timestamp; + $tmp->xmlrpc_type = 'datetime'; + $this->setNativeValue($tmp); + } + + // }}} + // {{{ _iso8601ToTimestamp() + + /** + * Convert a iso8601 datetime string into timestamp + * + * @param string $datetime iso8601 datetime + * @return int corresponding timestamp + */ + private static function _iso8601ToTimestamp($datetime) + { + if (!preg_match('/([0-9]{4})(-?([0-9]{2})(-?([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?/', $datetime, $matches)) { + throw new XML_RPC2_InvalidDateFormatException(sprintf('Provided date \'%s\' is not ISO-8601.', $datetime)); + } + $year = $matches[1]; + $month = array_key_exists(3, $matches) ? $matches[3] : 1; + $day = array_key_exists(5, $matches) ? $matches[5] : 1; + $hour = array_key_exists(7, $matches) ? $matches[7] : 0; + $minutes = array_key_exists(8, $matches) ? $matches[8] : 0; + $seconds = array_key_exists(10, $matches) ? $matches[10] : 0; + $milliseconds = array_key_exists(12, $matches) ? ((double) ('0.' . $matches[12])) : 0; + if (array_key_exists(13, $matches)) { + if ($matches[13] == 'Z') { + $tzSeconds = 0; + } else { + $tmp = ($matches[15] == '-') ? -1 : 1; + $tzSeconds = $tmp * (((int) $matches[16]) * 3600 + ((int) $matches[17]) * 60); + } + } else { + $tzSeconds = 0; + } + if (class_exists('DateTime')) { + $result = new DateTime(); + $result->setDate($year, $month, $day); + $result->setTime($hour, $minutes, $seconds); + $result = $result->getTimestamp(); + if ($milliseconds==0) return $result; + return ((float) $result) + $milliseconds/1000; + } else { + $result = ((double) @mktime($hour, $minutes, $seconds, $month, $day, $year, 0)) + + ((double) $milliseconds) - + ((double) $tzSeconds); + if ($milliseconds==0) return ((int) $result); + return $result; + } + } + + // }}} + // {{{ _timestampToIso8601() + + /** + * Convert a timestamp into an iso8601 datetime + * + * @param int $timestamp timestamp + * @return string iso8601 datetim + */ + private static function _timestampToIso8601($timestamp) + { + return strftime('%Y%m%dT%H:%M:%S', (int) $timestamp); + } + + // }}} + // {{{ decode() + + /** + * Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/dateTime.iso8601/text()'); + if (!array_key_exists(0, $value)) { + $value = $xml->xpath('/value/text()'); + } + // Emulate xmlrpcext results (to be able to switch from a backend to another) + $result = new stdclass(); + $result->scalar = (string) $value[0]; + $result->timestamp = (int) XML_RPC2_Backend_Php_Value_Datetime::_iso8601ToTimestamp((string) $value[0]); + $result->xmlrpc_type = 'datetime'; + return $result; + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + $native = $this->getNativeValue(); + return '' . $native->scalar . ''; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Double.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Double.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Double.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Double.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,96 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC double value class. Instances of this class represent int scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Double extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Double with the given value + * + * @param mixed value + */ + public function __construct($nativeValue) + { + $this->setScalarType('double'); + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/double/text()'); + + // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 + return (double) ((string) $value[0]); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer64.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer64.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer64.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer64.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,97 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Integer64.php 224219 2006-12-02 18:09:49Z sergiosgc $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC integer value class. Instances of this class represent int scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Integer64 extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Integer64 with the given value + * + * @param mixed value + */ + public function __construct($nativeValue) + { + if (PHP_INT_SIZE < 8) throw new XML_RPC2_ConfigException('i8 XML-RPC extension can only be used with 64 bit (or larger) architectures'); + $this->setScalarType('i8'); + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The decoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/i8/text()'); + + // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 + return (int) ((string) $value[0]); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Integer.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,96 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC integer value class. Instances of this class represent int scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Integer extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Integer with the given value + * + * @param mixed value + */ + public function __construct($nativeValue) + { + $this->setScalarType('int'); + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The decoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $value = $xml->xpath('/value/int/text()|/value/i4/text()'); + + // Double cast explanation: http://pear.php.net/bugs/bug.php?id=8644 + return (int) ((string) $value[0]); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Nil.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Nil.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Nil.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Nil.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,90 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Nil.php 224219 2006-12-02 18:09:49Z sergiosgc $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC null value class. Instances of this class represent null scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Nil extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Nil with the given value + * + * @param mixed value + */ + public function __construct() + { + $this->setScalarType('nil'); + $this->setNativeValue(null); + } + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The decoded XML-RPC value, + */ + public static function decode($xml) + { + return null; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Scalar.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Scalar.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Scalar.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Scalar.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,179 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value.php'; +// }}} + +/** + * XML_RPC scalar value abstract class. All XML_RPC value classes representing scalar types inherit from XML_RPC2_Value_Scalar + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Backend_Php_Value_Scalar extends XML_RPC2_Backend_Php_Value +{ + + // {{{ properties + + /** + * scalar type + * + * @var string + */ + private $_scalarType = null; + + // }}} + // {{{ setScalarType() + + /** + * scalarType property setter + * + * @param mixed value The new scalarType + */ + protected function setScalarType($value) + { + switch ($value) { + case 'nil': + case 'int': + case 'i8': + case 'i4': + case 'boolean': + case 'string': + case 'double': + case 'dateTime.iso8601': + case 'base64': + $this->_scalarType = $value; + break; + default: + throw new XML_RPC2_InvalidTypeException(sprintf('Type \'%s\' is not an XML-RPC scalar type', $value)); + } + } + + // }}} + // {{{ getScalarType() + + /** + * scalarType property getter + * + * @return mixed The current scalarType + */ + public function getScalarType() + { + return $this->_scalarType; + } + + // }}} + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Value_Scalar with the given nativeValue + * + * @param mixed nativeValue + */ + public function __construct($scalarType, $nativeValue) + { + $this->setScalarType($scalarType); + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ createFromNative() + + /** + * Choose a XML_RPC2_Value subclass appropriate for the + * given value and create it. + * + * @param string The native value + * @param string Optinally, the scalar type to use + * @throws XML_RPC2_InvalidTypeEncodeException When native value's type is not a native type + * @return XML_RPC2_Value The newly created value + */ + public static function createFromNative($nativeValue, $explicitType = null) + { + if (is_null($explicitType)) { + switch (gettype($nativeValue)) { + case 'integer': + $explicitType = $nativeValue <= 2147483647 /* PHP_INT_MAX on 32 bit systems */ ? gettype($nativeValue) : 'Integer64'; + break; + case 'NULL': + $explicitType = 'Nil'; + break; + case 'boolean': + case 'double': + case 'string': + $explicitType = gettype($nativeValue); + break; + default: + throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Impossible to encode scalar value \'%s\' from type \'%s\'. Native type is not a scalar XML_RPC type (boolean, integer, double, string)', + (string) $nativeValue, + gettype($nativeValue))); + } + } + $explicitType = ucfirst(strtolower($explicitType)); + require_once(sprintf('XML/RPC2/Backend/Php/Value/%s.php', $explicitType)); + $explicitType = sprintf('XML_RPC2_Backend_Php_Value_%s', $explicitType); + return new $explicitType($nativeValue); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + return '<' . $this->getScalarType() . '>' . $this->getNativeValue() . 'getScalarType() . '>'; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/String.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/String.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/String.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/String.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,110 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; +// }}} + +/** + * XML_RPC string value class. Instances of this class represent string scalars in XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_String extends XML_RPC2_Backend_Php_Value_Scalar +{ + + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_String with the given value + * + * @param mixed value + */ + public function __construct($nativeValue) + { + $this->setScalarType('string'); + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + return '' . strtr($this->getNativeValue(),array('&' => '&', '<' => '<' , '>' => '>')) . ''; + } + + // }}} + // {{{ decode() + + /** + * Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + /* Stupid way of testing for the presence of string element. I don't know another one. + At least got rid of the xpath and consequent reparsing of the XML + */ + if ($xml->string->asXML() === FALSE) { + return (string) $xml; + } else { + return (string) $xml->string; + } + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Struct.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Struct.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Struct.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value/Struct.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,140 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend/Php/Value.php'; +// }}} + +/** + * XML_RPC struct value class. Represents values of type struct (associative struct) + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Php_Value_Struct extends XML_RPC2_Backend_Php_Value +{ + + // {{{ setNativeValue() + + /** + * nativeValue property setter + * + * @param mixed value the new nativeValue + */ + protected function setNativeValue($value) + { + if (!is_array($value)) { + throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Struct from type \'%s\'.', gettype($value))); + } + parent::setNativeValue($value); + } + + // }}} + // {{{ constructor + + /** + * Constructor. Will build a new XML_RPC2_Backend_Php_Value_Scalar with the given nativeValue + * + * @param mixed nativeValue + */ + public function __construct($nativeValue) + { + $this->setNativeValue($nativeValue); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + public function encode() + { + $result = ''; + foreach($this->getNativeValue() as $name => $element) { + $result .= ''; + $result .= ''; + $result .= strtr($name, array('&' => '&', '<' => '<', '>' => '>')); + $result .= ''; + $result .= ''; + $result .= ($element instanceof XML_RPC2_Backend_Php_Value) ? + $element->encode() : + XML_RPC2_Backend_Php_Value::createFromNative($element)->encode(); + $result .= ''; + $result .= ''; + } + $result .= ''; + return $result; + } + + // }}} + // {{{ decode() + + /** + * Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + public static function decode($xml) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $xml = simplexml_load_string($xml->asXML()); + $values = $xml->xpath('/value/struct/member'); + $result = array(); + foreach (array_keys($values) as $i) { + $result[(string) $values[$i]->name] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i]->value)->getNativeValue(); + } + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Php/Value.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,302 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2005 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Value.php'; +// }}} + +/** + * XML_RPC value abstract class. All XML_RPC value classes inherit from XML_RPC2_Value + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2005 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Backend_Php_Value extends XML_RPC2_Value +{ + // {{{ properties + + /** + * native value + * + * @var mixed + */ + private $_nativeValue = null; + + // }}} + // {{{ getNativeValue() + + /** + * nativeValue property getter + * + * @return mixed The current nativeValue + */ + public function getNativeValue() + { + return $this->_nativeValue; + } + + // }}} + // {{{ setNativeValue() + + /** + * nativeValue setter + * + * @param mixed $value + */ + protected function setNativeValue($value) + { + $this->_nativeValue = $value; + } + + // }}} + // {{{ createFromNative() + + /** + * Choose a XML_RPC2_Value subclass appropriate for the + * given value and create it. + * + * This method tries to find the most adequate XML-RPC datatype to hold + * a given PHP native type. Note that distinguishing some datatypes may be + * difficult: + * - Timestamps are represented by PHP integers, so an XML_RPC2_Value_Datetime is never returned + * - Indexed arrays and associative arrays are the same native PHP type. In this case: + * a) The array's indexes start at 0 or 1 and increase monotonically with step 1, or + * b) they do not + * in the first case, an XML_RPC2_Value_Array is returned. In the second, a XML_RPC2_Value_Struct is returned. + * - PHP Objects are serialized and represented in an XML_RPC2_Value_Base64 + * - Integers fitting in a 32bit integer are encoded as regular xml-rpc integers + * - Integers larger than 32bit are encoded using the i8 xml-rpc extension + * + * Whenever native object automatic detection proves inaccurate, use XML_RPC2_Value::createFromNative providing + * a valid explicit type as second argument + * + * the appropriate XML_RPC2_Value child class instead. + * + * @param mixed The native value + * @param string The xml-rpc target encoding type, as per the xmlrpc spec (optional) + * @throws XML_RPC2_InvalidTypeEncodeException When the native value has a type that can't be translated to XML_RPC + * @return A new XML_RPC2_Value instance + * @see XML_RPC_Client::__call + * @see XML_RPC_Server + */ + public static function createFromNative($nativeValue, $explicitType = null) + { + if (is_null($explicitType)) { + switch (gettype($nativeValue)) { + case 'boolean': + $explicitType = 'boolean'; + break; + case 'integer': + $explicitType = 'int'; + break; + case 'double': + $explicitType = 'double'; + break; + case 'string': + $explicitType = 'string'; + break; + case 'array': + $explicitType = 'array'; + $keys = array_keys($nativeValue); + if (count($keys) > 0) { + if ($keys[0] !== 0 && ($keys[0] !== 1)) $explicitType = 'struct'; + $i=0; + do { + $previous = $keys[$i]; + $i++; + if (array_key_exists($i, $keys) && ($keys[$i] !== $keys[$i - 1] + 1)) $explicitType = 'struct'; + } while (array_key_exists($i, $keys) && $explicitType == 'array'); + } + break; + case 'object': + if ((strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) { + // In this case, we have a "stdclass native value" (emulate xmlrpcext) + // the type 'base64' or 'datetime' is given by xmlrpc_type public property + $explicitType = $nativeValue->xmlrpc_type; + } else { + $nativeValue = serialize($nativeValue); + $explicitType = 'base64'; + } + break; + case 'resource': + case 'NULL': + case 'unknown type': + throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Impossible to encode value \'%s\' from type \'%s\'. No analogous type in XML_RPC.', + (string) $nativeValue, + gettype($nativeValue))); + default: + throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Unexpected PHP native type returned by gettype: \'%s\', for value \'%s\'', + gettype($nativeValue), + (string) $nativeValue)); + } + } + $explicitType = ucfirst(strtolower($explicitType)); + switch ($explicitType) { + case 'I8': + require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; + return XML_RPC2_Backend_Php_Value_Scalar::createFromNative($nativeValue, 'Integer64'); + break; + case 'I4': + case 'Int': + case 'Boolean': + case 'Double': + case 'String': + case 'Nil': + require_once 'XML/RPC2/Backend/Php/Value/Scalar.php'; + return XML_RPC2_Backend_Php_Value_Scalar::createFromNative($nativeValue); + break; + case 'Datetime.iso8601': + case 'Datetime': + require_once 'XML/RPC2/Backend/Php/Value/Datetime.php'; + return new XML_RPC2_Backend_Php_Value_Datetime($nativeValue); + break; + case 'Base64': + require_once 'XML/RPC2/Backend/Php/Value/Base64.php'; + return new XML_RPC2_Backend_Php_Value_Base64($nativeValue); + break; + case 'Array': + require_once 'XML/RPC2/Backend/Php/Value/Array.php'; + return new XML_RPC2_Backend_Php_Value_Array($nativeValue); + break; + case 'Struct': + require_once 'XML/RPC2/Backend/Php/Value/Struct.php'; + return new XML_RPC2_Backend_Php_Value_Struct($nativeValue); + break; + default: + throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Unexpected explicit encoding type \'%s\'', $explicitType)); + } + } + + // }}} + // {{{ createFromDecode() + + /** + * Decode an encoded value and build the applicable XML_RPC2_Value subclass + * + * @param SimpleXMLElement The encoded XML-RPC value + * @return mixed the corresponding XML_RPC2_Value object + */ + public static function createFromDecode($simpleXML) + { + // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when + // xpath is used both in an element and in one of its children + $simpleXML = simplexml_load_string($simpleXML->asXML()); + + $valueType = $simpleXML->xpath('./*'); + if (count($valueType) == 1) { // Usually we must check the node name + $nodename = dom_import_simplexml($valueType[0])->nodeName; + switch ($nodename) { + case 'i8': + $nativeType = 'Integer64'; + break; + case 'i4': + case 'int': + $nativeType = 'Integer'; + break; + case 'boolean': + $nativeType = 'Boolean'; + break; + case 'double': + $nativeType = 'Double'; + break; + case 'string': + $nativeType = 'String'; + break; + case 'dateTime.iso8601': + $nativeType = 'Datetime'; + break; + case 'base64': + $nativeType = 'Base64'; + break; + case 'array': + $nativeType = 'Array'; + break; + case 'struct': + $nativeType = 'Struct'; + break; + case 'nil': + $nativeType = 'Nil'; + break; + default: + throw new XML_RPC2_DecodeException(sprintf('Unable to decode XML-RPC value. Value type is not recognized \'%s\'', $nodename)); + } + } elseif (count($valueType) == 0) { // Default type is string + $nodename = null; + $nativeType = 'String'; + } else { + throw new XML_RPC2_DecodeException(sprintf('Unable to decode XML-RPC value. Value presented %s type nodes: %s.', count($valueType), $simpleXML->asXML())); + } + require_once(sprintf('XML/RPC2/Backend/Php/Value/%s.php', $nativeType)); + $nativeType = 'XML_RPC2_Backend_Php_Value_' . $nativeType; + return self::createFromNative(@call_user_func(array($nativeType, 'decode'), $simpleXML), $nodename); + } + + // }}} + // {{{ encode() + + /** + * Encode the instance into XML, for transport + * + * @return string The encoded XML-RPC value, + */ + // Declaration commented because of: http://pear.php.net/bugs/bug.php?id=8499 +// public abstract function encode(); + + // }}} + // {{{ decode() + + /** + * decode. Decode transport XML and set the instance value accordingly + * + * @param mixed The encoded XML-RPC value, + */ + // Declaration commented because of: http://pear.php.net/bugs/bug.php?id=8499 +// public static abstract function decode($xml); + + // }}} +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Client.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Client.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,143 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Client.php'; +require_once 'XML/RPC2/Util/HTTPRequest.php'; +//}}} + +/** + * XML_RPC client backend class. This backend class uses the XMLRPCext extension to execute the call. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Xmlrpcext_Client extends XML_RPC2_Client +{ + + // {{{ constructor + + /** + * Construct a new XML_RPC2_Client PHP Backend. + * + * A URI must be provided (e.g. http://xmlrpc.example.com/1.0/). + * Optionally, some options may be set. + * + * @param string URI for the XML-RPC server + * @param array (optional) Associative array of options + */ + public function __construct($uri, $options = array()) + { + parent::__construct($uri, $options); + } + + // }}} + // {{{ __call() + + /** + * __call Catchall. This method catches remote method calls and provides for remote forwarding. + * + * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to + * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value + * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative + * proves inacurate -- as when encoding DateTime values -- you should present an instance of + * XML_RPC_Value in lieu of the native parameter. + * + * @param string Method name + * @param array Parameters + * @return mixed The call result, already decoded into native types + */ + public function __call($methodName, $parameters) + { + $tmp = xmlrpc_encode_request($this->prefix . $methodName, $parameters, array('escaping' => $this->escaping, 'encoding' => $this->encoding)); + if ($this->uglyStructHack) { + // ugly hack because of http://bugs.php.net/bug.php?id=21949 + // see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos + $request = preg_replace('~xml_rpc2_ugly_struct_hack_(.*)~', '\1', $tmp); + } else { + $request = $tmp; + } + $uri = $this->uri; + $options = array( + 'encoding' => $this->encoding, + 'proxy' => $this->proxy, + 'sslverify' => $this->sslverify, + 'connectionTimeout' => $this->connectionTimeout + ); + if (isset($this->httpRequest)) $options['httpRequest'] = $this->httpRequest; + $httpRequest = new XML_RPC2_Util_HTTPRequest($uri, $options); + $httpRequest->setPostData($request); + $httpRequest->sendRequest(); + $body = $httpRequest->getBody(); + if ($this->debug) { + XML_RPC2_ClientHelper::printPreParseDebugInfo($request, $body); + } + $result = xmlrpc_decode($body, $this->encoding); + /* Commented due to change in behaviour from xmlrpc_decode. It does not return faults now + if ($result === false || is_null($result)) { + if ($this->debug) { + print "XML_RPC2_Exception : unable to decode response !"; + } + throw new XML_RPC2_Exception('Unable to decode response'); + } + */ + if (is_array($result) && xmlrpc_is_fault($result)) { + if ($this->debug) { + print "XML_RPC2_FaultException(${result['faultString']}, ${result['faultCode']})"; + } + throw new XML_RPC2_FaultException($result['faultString'], $result['faultCode']); + } + if ($this->debug) { + XML_RPC2_ClientHelper::printPostRequestDebugInformation($result); + } + return $result; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Server.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Server.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,179 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Backend/Php/Request.php'; +require_once 'XML/RPC2/Backend/Php/Response.php'; +require_once 'XML/RPC2/Exception.php'; +// }}} + +/** + * XML_RPC server class XMLRPCext extension-based backend + * + * The XML_RPC2_Server does the work of decoding and encoding xml-rpc request and response. The actual + * method execution is delegated to the call handler instance. + * + * The XML_RPC server is responsible for decoding the request and calling the appropriate method in the + * call handler class. It then encodes the result into an XML-RPC response and returns it to the client. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Xmlrpcext_Server extends XML_RPC2_Server +{ + // {{{ properties + + /** + * xmlrpcext server + * + * @var resource + */ + private $_xmlrpcextServer; + + // }}} + // {{{ constructor + + /** + * Create a new XML-RPC Server. + * + * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual + * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client + * + * @param object $callHandler + * @param array $options associative array of options + */ + function __construct($callHandler, $options = array()) + { + parent::__construct($callHandler, $options); + $this->_xmlrpcextServer = xmlrpc_server_create(); + foreach ($callHandler->getMethods() as $method) { + if (xmlrpc_server_register_method($this->_xmlrpcextServer, + $method->getName(), + array($this, 'epiFunctionHandlerAdapter')) !== true) { + throw new XML_RPC2_Exception('Unable to setup XMLRPCext server. xmlrpc_server_register_method returned non-true.'); + } + } + } + + // }}} + // {{{ epiFunctionHandlerAdapter() + + /** + * This is an adapter between XML_RPC2_CallHandler::__call and xmlrpc_server_register_method callback interface + * + * @param string Method name + * @param array Parameters + * @param array Application data (ignored) + */ + protected function epiFunctionHandlerAdapter($method_name, $params, $app_data) { + return @call_user_func_array(array($this->callHandler, $method_name), $params); + } + + // }}} + // {{{ handleCall() + + /** + * Respond to the XML-RPC request. + * + * handleCall reads the XML-RPC request from the raw HTTP body and decodes it. It then calls the + * corresponding method in the call handler class, returning the encoded result to the client. + */ + public function handleCall() + { + if ($this->autoDocument && $this->input->isEmpty()) { + $this->autoDocument(); + } else { + $response = $this->getResponse(); + header('Content-type: text/xml; charset=' . $this->encoding); + header('Content-length: ' . $this->getContentLength($response)); + print $response; + } + } + + // }}} + // {{{ getResponse() + + /** + * get the XML response of the XMLRPC server + * + * @return string the XML response + */ + public function getResponse() + { + try { + if ($this->signatureChecking) { + $tmp = xmlrpc_parse_method_descriptions($this->input->readRequest()); + $methodName = $tmp['methodName']; + $parameters = xmlrpc_decode($this->input->readRequest(), $this->encoding); + $method = $this->callHandler->getMethod($methodName); + if (!($method)) { + // see http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php for standard error codes + return (XML_RPC2_Backend_Php_Response::encodeFault(-32601, 'server error. requested method not found')); + } + if (!($method->matchesSignature($methodName, $parameters))) { + return (XML_RPC2_Backend_Php_Response::encodeFault(-32602, 'server error. invalid method parameters')); + } + } + set_error_handler(array('XML_RPC2_Backend_Xmlrpcext_Server', 'errorToException')); + $response = @xmlrpc_server_call_method($this->_xmlrpcextServer, + $this->input->readRequest(), + null, + array('output_type' => 'xml', 'encoding' => $this->encoding)); + restore_error_handler(); + return $response; + } catch (XML_RPC2_FaultException $e) { + return (XML_RPC2_Backend_Php_Response::encodeFault($e->getFaultCode(), $e->getMessage())); + } catch (Exception $e) { + if (ini_get('display_errors') == 1) { + return (XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled ' . get_class($e) . ' exception:' . $e->getMessage())); + } else { + return XML_RPC2_Backend_Php_Response::encodeFault(1, 'Unhandled PHP Exception'); + } + } + } + // }}} +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Value.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend/Xmlrpcext/Value.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,101 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend.php'; +// }}} + +/** + * XML_RPC value class for the XMLRPCext backend. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Backend_Xmlrpcext_Value +{ + + // {{{ createFromNative() + + /** + * Factory method that constructs the appropriate XML-RPC encoded type value + * + * @param mixed Value to be encode + * @param string Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type) + * @return mixed The encoded value + */ + public static function createFromNative($value, $explicitType) + { + $type = strtolower($explicitType); + $availableTypes = array('datetime', 'base64', 'struct'); + if (in_array($type, $availableTypes)) { + if ($type=='struct') { + if (!(is_array($value))) { + throw new XML_RPC2_Exception('With struct type, value has to be an array'); + } + // Because of http://bugs.php.net/bug.php?id=21949 + // is some cases (structs with numeric indexes), we need to be able to force the "struct" type + // (xmlrpc_set_type doesn't help for this, so we need this ugly hack) + $new = array(); + while (list($k, $v) = each($value)) { + $new["xml_rpc2_ugly_struct_hack_$k"] = $v; + // with this "string" prefix, we are sure that the array will be seen as a "struct" + } + return $new; + } + $value2 = (string) $value; + if (!xmlrpc_set_type($value2, $type)) { + throw new XML_RPC2_Exception('Error returned from xmlrpc_set_type'); + } + return $value2; + } + return $value; + } + + // }}} + +} + +?> \ No newline at end of file diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Backend.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Backend.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,191 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'PEAR.php'; +// }}} + +/** + * XML_RPC Backend class. The backend is responsible for the actual execution of + * a request, as well as payload encoding and decoding. + * + * The only external usage of this class is when explicitely setting the backend, as in + * + * XML_RPC2_Backend::setBackend('php'); + * // or + * XML_RPC2_Backend::setBackend('xmlrpcext'); + * + * Note that if you do not explicitely set the backend, it will be selected automatically. + * + * Internally, this class provides methods to obtain the relevant backend classes: + * - The server class + * - The client class + * - The value class + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Backend +{ + + // {{{ properties + + /** + * current backend + * + * @var string + */ + protected static $currentBackend; + + // }}} + // {{{ setBackend() + + /** + * Backend setter. + * + * Currently, two backends exist: 'php' and 'XMLRPCext'. + * The PHP backend has no external dependencies, while the xmlrpcext + * requires the xmlrpc extension. + * + * The XMLRPCext backend is quite faster, and will be automatically + * selected when no explicit backend has been set and the extension + * is available. + * + * @param string The backend to select. Either 'php' or 'XMLRPCext'. + */ + public static function setBackend($backend) + { + $backend = ucfirst(strtolower($backend)); + if ( + $backend != 'Php' && + $backend != 'Xmlrpcext' + ) { + throw new XML_RPC2_Exception(sprintf('Backend %s does not exist', $backend)); + } + if ( + $backend == 'Xmlrpcext' && + !function_exists('xmlrpc_server_create') && + !( PEAR::loadExtension('php_xmlrpc') ) + ) { + throw new XML_RPC2_Exception('Unable to load xmlrpc extension.'); + } + self::$currentBackend = $backend; + } + + // }}} + // {{{ getBackend() + + /** + * Backend getter. + * + * Return the current backend name. If no backend was previously selected + * select one and set it. + * + * The xmlrpcext backend is preferred, and will be automatically + * selected when no explicit backend has been set and the xmlrpc + * extension exists. If it does not exist, then the php backend is + * selected. + * + * @return string The current backend + */ + protected static function getBackend() + { + if (!isset(self::$currentBackend)) { + try { + self::setBackend('XMLRPCext'); // We prefer this one + } catch (XML_RPC2_Exception $e) { + // TODO According to PEAR CG logging should occur here + self::setBackend('php'); // But will settle with this one in case of error + } + } + return self::$currentBackend; + } + + // }}} + // {{{ getServerClassname() + + /** + * Include the relevant php files for the server class, and return the backend server + * class name. + * + * @return string The Server class name + */ + public static function getServerClassname() { + require_once(sprintf('XML/RPC2/Backend/%s/Server.php', self::getBackend())); + return sprintf('XML_RPC2_Backend_%s_Server', self::getBackend()); + } + + // }}} + // {{{ getClientClassname() + + /** + * Include the relevant php files for the client class, and return the backend client + * class name. + * + * @return string The Client class name + */ + public static function getClientClassname() { + require_once(sprintf('XML/RPC2/Backend/%s/Client.php', self::getBackend())); + return sprintf('XML_RPC2_Backend_%s_Client', self::getBackend()); + } + + // }}} + // {{{ getValueClassname() + + /** + * Include the relevant php files for the value class, and return the backend value + * class name. + * + * @return string The Value class name + */ + public static function getValueClassname() { + require_once(sprintf('XML/RPC2/Backend/%s/Value.php', self::getBackend())); + return sprintf('XML_RPC2_Backend_%s_Value', self::getBackend()); + } + + // }}} + +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/CachedClient.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/CachedClient.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/CachedClient.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/CachedClient.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,361 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Fabien MARTY +* @copyright 2005-2006 Fabien MARTY +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once('Cache/Lite.php'); +require_once('XML/RPC2/Exception.php'); +// }}} + +/** + * XML_RPC "cached client" class. + * + * @category XML + * @package XML_RPC2 + * @author Fabien MARTY + * @copyright 2005-2006 Fabien MARTY + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_CachedClient { + + // {{{ properties + + /** + * Associative array of options for XML_RPC2_Client + * + * @var array + */ + private $_options; + + /** + * uri Field (holds the uri for the XML_RPC server) + * + * @var array + */ + private $_uri; + + /** + * Holds the debug flag + * + * @var boolean + */ + private $_debug = false; + + /** + * Cache_Lite options array + * + * @var array + */ + private $_cacheOptions = array(); + + /** + * Cached methods array (usefull only if cache is off by default) + * + * example1 : array('method1ToCache', 'method2ToCache', ...) + * example2 (with specific cache lifetime) : + * array('method1ToCache' => 3600, 'method2ToCache' => 60, ...) + * NB : a lifetime value of -1 means "no cache for this method" + * + * @var array + */ + private $_cachedMethods = array(); + + /** + * Non-Cached methods array (usefull only if cache is on by default) + * + * example : array('method1ToCache', 'method2ToCache', ...) + * + * @var array + */ + private $_notCachedMethods = array(); + + /** + * cache by default + * + * @var boolean + */ + private $_cacheByDefault = true; + + /** + * Cache_Lite object + * + * @var object + */ + private $_cacheObject = null; + + /** + * XML_RPC2_Client object (if needed, dynamically built) + * + * @var object + */ + private $_clientObject = null; + + /** + * Default cache group for XML_RPC client caching + * + * @var string + */ + private $_defaultCacheGroup = 'xml_rpc2_client'; + + /** + * "cache debug" flag (for debugging the caching process) + * + * @var boolean + */ + private $_cacheDebug = false; + + // }}} + // {{{ constructor + + /** + * Constructor + * + * TODO : documentations about cache options + * + * @param string URI for the XML-RPC server + * @param array (optional) Associative array of options + */ + protected function __construct($uri, $options = array()) + { + if (isset($options['cacheOptions'])) { + $array = $options['cacheOptions']; + if (isset($array['defaultCacheGroup'])) { + $this->_defaultCacheGroup = $array['defaultCacheGroup']; + unset($array['defaultCacheGroup']); // this is a "non standard" option for Cache_Lite + } + if (isset($array['cachedMethods'])) { + $this->_cachedMethods = $array['cachedMethods']; + unset($array['cachedMethods']); // this is a "non standard" option for Cache_Lite + } + if (isset($array['notCachedMethods'])) { + $this->_notCachedMethods = $array['notCachedMethods']; + unset($array['notCachedMethods']); // this is a "non standard" option for Cache_Lite + } + if (isset($array['cacheByDefault'])) { + $this->_cacheByDefault = $array['cacheByDefault']; + unset($array['CacheByDefault']); // this is a "non standard" option for Cache_Lite + } + $array['automaticSerialization'] = false; // datas are already serialized in this class + if (!isset($array['lifetime'])) { + $array['lifetime'] = 3600; // we need a default lifetime + } + unset($options['cacheOptions']); // this is a "non standard" option for XML/RPC2/Client + } else { // no cache options ? + $array = array( + 'lifetime' => 3600, // we need a default lifetime + 'automaticSerialization' => false // datas are already serialized in this class + ); + } + if (isset($options['cacheDebug'])) { + $this->_cacheDebug = $options['cacheDebug']; + unset($options['cacheDebug']); // this a "non standard" option for XML/RPC2/Client + } + $this->_cacheOptions = $array; + $this->_cacheObject = new Cache_Lite($this->_cacheOptions); + $this->_options = $options; + $this->_uri = $uri; + } + + // }}} + // {{{ create() + + /** + * "Emulated Factory" method to get the same API than XML_RPC2_Client class + * + * Here, simply returns a new instance of XML_RPC2_CachedClient class + * + * @param string URI for the XML-RPC server + * @param string (optional) Prefix to prepend on all called functions (defaults to '') + * @param string (optional) Proxy server URI (defaults to no proxy) + * + */ + public static function create($uri, $options = array()) + { + return new XML_RPC2_CachedClient($uri, $options); + } + + // }}} + // {{{ __call() + + /** + * __call Catchall + * + * Encapsulate all the class logic : + * - determine if the cache has to be used (or not) for the called method + * - see if a cache is available for this call + * - if no cache available, really do the call and store the result for next time + * + * @param string Method name + * @param array Parameters + * @return mixed The call result, already decoded into native types + */ + public function __call($methodName, $parameters) + { + if (!isset($this->_cacheObject)) { + $this->_cacheObject = new Cache_Lite($this->_cacheOptions); + } + if (in_array($methodName, $this->_notCachedMethods)) { + // if the called method is listed in _notCachedMethods => no cache + if ($this->_cacheDebug) { + print "CACHE DEBUG : the called method is listed in _notCachedMethods => no cache !\n"; + } + return $this->_workWithoutCache___($methodName, $parameters); + } + if (!($this->_cacheByDefault)) { + if ((!(isset($this->_cachedMethods[$methodName]))) and (!(in_array($methodName, $this->_cachedMethods)))) { + // if cache is not on by default and if the called method is not described in _cachedMethods array + // => no cache + if ($this->_cacheDebug) { + print "CACHE DEBUG : cache is not on by default and the called method is not listed in _cachedMethods => no cache !\n"; + } + return $this->_workWithoutCache___($methodName, $parameters); + } + } + if (isset($this->_cachedMethods[$methodName])) { + if ($this->_cachedMethods[$methodName] == -1) { + // if a method is described with a lifetime value of -1 => no cache + if ($this->_cacheDebug) { + print "CACHE DEBUG : called method has a -1 lifetime value => no cache !\n"; + } + return $this->_workWithoutCache___($methodName, $parameters); + } + // if a method is described with a specific (and <> -1) lifetime + // => we fix this new lifetime + $this->_cacheObject->setLifetime($this->_cachedMethods[$methodName]); + } else { + // there is no specific lifetime, let's use the default one + $this->_cacheObject->setLifetime($this->_cacheOptions['lifetime']); + } + $cacheId = $this->_makeCacheId___($methodName, $parameters); + $data = $this->_cacheObject->get($cacheId, $this->_defaultCacheGroup); + if (is_string($data)) { + // cache is hit ! + if ($this->_cacheDebug) { + print "CACHE DEBUG : cache is hit !\n"; + } + return unserialize($data); + } + // the cache is not hit, let's call the "real" XML_RPC client + if ($this->_cacheDebug) { + print "CACHE DEBUG : cache is not hit !\n"; + } + $result = $this->_workWithoutCache___($methodName, $parameters); + $this->_cacheObject->save(serialize($result)); // save in cache for next time... + return $result; + } + + // }}} + // {{{ _workWithoutCache___() + + /** + * Do the real call if no cache available + * + * NB : The '___' at the end of the method name is to avoid collisions with + * XMLRPC __call() + * + * @param string Method name + * @param array Parameters + * @return mixed The call result, already decoded into native types + */ + private function _workWithoutCache___($methodName, $parameters) + { + if (!(isset($this->_clientObject))) { + // If the XML_RPC2_Client object is not available, let's build it + require_once('XML/RPC2/Client.php'); + $this->_clientObject = XML_RPC2_Client::create($this->_uri, $this->_options); + } + // the real function call... + return call_user_func_array(array($this->_clientObject, $methodName), $parameters); + } + + // }}} + // {{{ _makeCacheId___() + + /** + * make a cache id depending on method called (and corresponding parameters) but depending on "environnement" setting too + * + * NB : The '___' at the end of the method name is to avoid collisions with + * XMLRPC __call() + * + * @param string $methodName called method + * @param array $parameters parameters of the called method + * @return string cache id + */ + private function _makeCacheId___($methodName, $parameters) + { + return md5($methodName . serialize($parameters) . serialize($this->_uri) . serialize($this->_options)); + } + + // }}} + // {{{ dropCacheFile___() + + /** + * Drop the cache file corresponding to the given method call + * + * NB : The '___' at the end of the method name is to avoid collisions with + * XMLRPC __call() + * + * @param string $methodName called method + * @param array $parameters parameters of the called method + */ + public function dropCacheFile___($methodName, $parameters) + { + $id = $this->_makeCacheId___($methodName, $parameters); + $this->_cacheObject->remove($id, $this->_defaultCacheGroup); + } + + // }}} + // {{{ clean___() + + /** + * Clean all the cache + * + * NB : The '___' at the end of the method name is to avoid collisions with + * XMLRPC __call() + */ + public function clean___() + { + $this->_cacheObject->clean($this->_defaultCacheGroup, 'ingroup'); + } + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/CachedServer.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/CachedServer.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/CachedServer.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/CachedServer.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,416 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Fabien MARTY +* @copyright 2005-2006 Fabien MARTY +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once('Cache/Lite.php'); +// }}} + +/** + * XML_RPC "cached server" class. + * + * @category XML + * @package XML_RPC2 + * @author Fabien MARTY + * @copyright 2005-2006 Fabien MARTY + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_CachedServer { + + // {{{ properties + + /** + * cache by default + * + * @var boolean + */ + private $_cacheByDefault = true; + + /** + * Cache_Lite object + * + * @var object + */ + private $_cacheObject = null; + + /** + * XML_RPC2_Server object (if needed, dynamically built) + * + * @var object + */ + private $_serverObject = null; + + /** + * Default cache group for XML_RPC server caching + * + * @var string + */ + private $_defaultCacheGroup = 'xml_rpc2_server'; + + /** + * callHandler field + * + * The call handler is responsible for executing the server exported methods + * + * @var mixed + */ + private $_callHandler = null; + + /** + * either a class name or an object instance + * + * @var mixed + */ + private $_callTarget = ''; + + /** + * methods prefix + * + * @var string + */ + private $_prefix = ''; + + /** + * XML_RPC2_Server options + * + * @var array + */ + private $_options = array(); + + /** + * "cache debug" flag (for debugging the caching process) + * + * @var boolean + */ + private $_cacheDebug = false; + + /** + * encoding + * + * @var string + */ + private $_encoding = 'utf-8'; + + // }}} + // {{{ setCacheOptions() + + /** + * Set options for the caching process + * + * See Cache_Lite constructor for options + * Specific options are 'cachedMethods', 'notCachedMethods', 'cacheByDefault', 'defaultCacheGroup' + * See corresponding properties for more informations + * + * @param array $array + */ + private function _setCacheOptions($array) + { + if (isset($array['defaultCacheGroup'])) { + $this->_defaultCacheGroup = $array['defaultCacheGroup']; + unset($array['defaultCacheGroup']); // this is a "non standard" option for Cache_Lite + } + if (isset($array['cacheByDefault'])) { + $this->_cacheByDefault = $array['cacheByDefault']; + unset($array['CacheByDefault']); // this is a "non standard" option for Cache_Lite + } + $array['automaticSerialization'] = false; // datas are already serialized in this class + if (!isset($array['lifetime'])) { + $array['lifetime'] = 3600; // we need a default lifetime + } + $this->_cacheOptions = $array; + $this->_cacheObject = new Cache_Lite($this->_cacheOptions); + } + + // }}} + // {{{ constructor + + /** + * Constructor + * + * @param object $callHandler the call handler will receive a method call for each remote call received. + */ + protected function __construct($callTarget, $options = array()) + { + if (isset($options['cacheOptions'])) { + $cacheOptions = $options['cacheOptions']; + $this->_setCacheOptions($cacheOptions); + unset($options['cacheOptions']); + } + if (isset($options['cacheDebug'])) { + $this->_cacheDebug = $options['cacheDebug']; + unset($options['cacheDebug']); // 'cacheDebug' is not a standard option for XML/RPC2/Server + } + $this->_options = $options; + $this->_callTarget = $callTarget; + if (isset($this->_options['encoding'])) { + $this->_encoding = $this->_options['encoding']; + } + if (isset($this->_options['prefix'])) { + $this->_prefix = $this->_options['prefix']; + } + } + + // }}} + // {{{ create() + + /** + * "Emulated Factory" method to get the same API than XML_RPC2_Server class + * + * Here, simply returns a new instance of XML_RPC2_CachedServer class + * + * @param mixed $callTarget either a class name or an object instance. + * @param array $options associative array of options + * @return object a server class instance + */ + public static function create($callTarget, $options = array()) + { + return new XML_RPC2_CachedServer($callTarget, $options); + } + + // }}} + // {{{ handleCall() + + /** + * handle XML_RPC calls + * + */ + public function handleCall() + { + $response = $this->getResponse(); + $encoding = 'utf-8'; + if (isset($this->_options['encoding'])) { + $encoding = $this->_options['encoding']; + } + header('Content-type: text/xml; charset=' . $encoding); + header('Content-length: ' . $this->getContentLength($response)); + print $response; + } + + /** + * get the XML response of the XMLRPC server + * + * @return string the XML response + */ + public function getResponse() + { + if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { + $methodName = $this->_parseMethodName($GLOBALS['HTTP_RAW_POST_DATA']); + } else { + $methodName = null; + } + $weCache = $this->_cacheByDefault; + $lifetime = $this->_cacheOptions['lifetime']; + if ($this->_cacheDebug) { + if ($weCache) { + print "CACHE DEBUG : default values => weCache=true, lifetime=$lifetime\n"; + } else { + print "CACHE DEBUG : default values => weCache=false, lifetime=$lifetime\n"; + } + } + if ($methodName) { + // work on reflection API to search for @xmlrpc.caching tags into PHPDOC comments + list($weCache, $lifetime) = $this->_reflectionWork($methodName); + if ($this->_cacheDebug) { + if ($weCache) { + print "CACHE DEBUG : phpdoc comments => weCache=true, lifetime=$lifetime\n"; + } else { + print "CACHE DEBUG : phpdoc comments => weCache=false, lifetime=$lifetime\n"; + } + } + } + if (($weCache) and ($lifetime!=-1)) { + if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { + $cacheId = $this->_makeCacheId($GLOBALS['HTTP_RAW_POST_DATA']); + } else { + $cacheId = 'norawpostdata'; + } + $this->_cacheObject = new Cache_Lite($this->_cacheOptions); + $this->_cacheObject->setLifetime($lifetime); + if ($data = $this->_cacheObject->get($cacheId, $this->_defaultCacheGroup)) { + // cache id hit + if ($this->_cacheDebug) { + print "CACHE DEBUG : cache is hit !\n"; + } + } else { + // cache is not hit + if ($this->_cacheDebug) { + print "CACHE DEBUG : cache is not hit !\n"; + } + $data = $this->_workWithoutCache(); + $this->_cacheObject->save($data); + } + } else { + if ($this->_cacheDebug) { + print "CACHE DEBUG : we don't cache !\n"; + } + $data = $this->_workWithoutCache(); + } + return $data; + } + + // }}} + // {{{ _reflectionWork() + + /** + * Work on reflection API to search for @xmlrpc.caching tags into PHPDOC comments + * + * @param string $methodName method name + * @return array array((boolean) weCache, (int) lifetime) => parameters to use for caching + */ + private function _reflectionWork($methodName) { + $weCache = $this->_cacheByDefault; + $lifetime = $this->_cacheOptions['lifetime']; + if (is_string($this->_callTarget)) { + $className = strtolower($this->_callTarget); + } else { + $className = get_class($this->_callTarget); + } + $class = new ReflectionClass($className); + $method = $class->getMethod($methodName); + $docs = explode("\n", $method->getDocComment()); + foreach ($docs as $i => $doc) { + $doc = trim($doc, " \r\t/*"); + $res = preg_match('/@xmlrpc.caching ([+-]{0,1}[a-zA-Z0-9]*)/', $doc, $results); // TODO : better/faster regexp ? + if ($res>0) { + $value = $results[1]; + if (($value=='yes') or ($value=='true') or ($value=='on')) { + $weCache = true; + } else if (($value=='no') or ($value=='false') or ($value=='off')) { + $weCache = false; + } else { + $lifetime = (int) $value; + if ($lifetime==-1) { + $weCache = false; + } else { + $weCache = true; + } + } + } + } + return array($weCache, $lifetime); + } + + // }}} + // {{{ _parseMethodName() + + /** + * Parse the method name from the raw XMLRPC client request + * + * NB : the prefix is removed from the method name + * + * @param string $request raw XMLRPC client request + * @return string method name + */ + private function _parseMethodName($request) + { + // TODO : change for "simplexml" + $res = preg_match('/' . $this->_prefix . '([a-zA-Z0-9\.,\/]*)<\/methodName>/', $request, $results); + if ($res>0) { + return $results[1]; + } + return false; + } + + // }}} + // {{{ _workWithoutCache() + + /** + * Do the real stuff if no cache available + * + * @return string the response of the real XML/RPC2 server + */ + private function _workWithoutCache() + { + require_once('XML/RPC2/Server.php'); + $this->_serverObject = XML_RPC2_Server::create($this->_callTarget, $this->_options); + return $this->_serverObject->getResponse(); + } + + // }}} + // {{{ _makeCacheId() + + /** + * make a cache id depending on the raw xmlrpc client request but depending on "environnement" setting too + * + * @param string $raw_request + * @return string cache id + */ + private function _makeCacheId($raw_request) + { + return md5($raw_request . serialize($this->_options)); + } + + // }}} + // {{{ clean() + + /** + * Clean all the cache + */ + public function clean() + { + $this->_cacheObject->clean($this->_defaultCacheGroup, 'ingroup'); + } + + // }}} + // {{{ getContentLength() + + /** + * Gets the content legth of a serialized XML-RPC message in bytes + * + * @param string $content the serialized XML-RPC message. + * + * @return integer the content length in bytes. + */ + protected function getContentLength($content) + { + if (extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) == 2) { + $length = mb_strlen($content, '8bit'); + } else { + $length = strlen((binary)$content); + } + + return $length; + } + + // }}} +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/ClientHelper.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/ClientHelper.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/ClientHelper.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/ClientHelper.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,118 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Client.php 308640 2011-02-24 20:46:30Z sergiosgc $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend.php'; +// }}} + +/** + * XML_RPC2 client helper class. + * + * XML_RPC2_Client must maintain a function namespace as clean as possible. As such + * whenever possible, methods that may be usefull to subclasses but shouldn't be defined + * in XML_RPC2 because of namespace pollution are defined here. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_ClientHelper +{ + // {{{ printPreParseDebugInfo() + + /** + * Display debug informations + * + * @param string $request XML client request + * @param string $body XML server response + */ + public static function printPreParseDebugInfo($request, $body) + { + print '
';
+        print "***** Request *****\n";
+        print htmlspecialchars($request);
+        print "***** End Of request *****\n\n";
+        print "***** Server response *****\n";
+        print htmlspecialchars($body);
+        print "\n***** End of server response *****\n\n";
+    }
+    
+    // }}}
+    // {{{ printPostRequestDebugInformation()
+    
+    /**
+     * Display debug informations (part 2)
+     *
+     * @param mixed $result decoded server response
+     */
+    public static function printPostRequestDebugInformation($result)
+    {
+        print "***** Decoded result *****\n";
+        print_r($result);
+        print "\n***** End of decoded result *****";
+        print '
'; + } + + // }}} + // {{{ testMethodName___() + + /** + * Return true is the given method name is ok with XML/RPC spec. + * + * NB : The '___' at the end of the method name is to avoid collisions with + * XMLRPC __call() + * + * @param string $methodName method name + * @return boolean true if ok + */ + public static function testMethodName($methodName) + { + return (preg_match('~^[a-zA-Z0-9_.:/]*$~', $methodName)); + } + + // }}} + +} + diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Client.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Client.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Client.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Client.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,261 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend.php'; +require_once 'XML/RPC2/ClientHelper.php'; +// }}} + +/** + * XML_RPC client class. Use this class to access remote methods. + * + * To use this class, construct it providing the server URL and method prefix. + * Then, call remote methods on the new instance as if they were local. + * + * Example: + * + * require_once 'XML_RPC2/Client.php'; + * + * $client = XML_RPC2_Client('http://xmlrpc.example.com/1.0/', 'example.'); + * $result = $client->hello('Sergio'); + * print($result); + * + * + * The above example will call the example.hello method on the xmlrpc.example.com + * server, under the /1.0/ URI. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Client +{ + // {{{ properties + + /** + * uri Field (holds the uri for the XML_RPC server) + * + * @var string + */ + protected $uri = null; + + /** + * proxy Field (holds the proxy server data) + * + * @var string + */ + protected $proxy = null; + + /** + * Holds the prefix to prepend to method names + * + * @var string + */ + protected $prefix = null; + + /** + * Holds the debug flag + * + * @var boolean + */ + protected $debug = false; + + /** + * Hold the encoding of the client request + * + * @var string + */ + protected $encoding = 'utf-8'; + + /** + * Holds the escaping method(s) of the client request + * + * @var string + */ + protected $escaping = array('non-ascii', 'non-print', 'markup'); + + /** + * Holds the SSL verify flag + * + * @var boolean + */ + protected $sslverify = true; + + /** + * Holds the connection timeout in milliseconds of the client request. + * + * @var integer + */ + protected $connectionTimeout = null; + + /** + * ugly hack flag to avoid http://bugs.php.net/bug.php?id=21949 + * + * see XML_RPC2_Backend_Xmlrpcext_Value::createFromNative() from more infos + */ + protected $uglyStructHack = true; + + /** + * Preconfigured HTTP_Request2 provided by the user + * + * @var HTTP_Request2 + */ + protected $httpRequest; + // }}} + + // {{{ constructor + + /** + * Construct a new XML_RPC2_Client. + * + * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). + * Optionally, some options may be set as an associative array. Accepted keys are : + * 'prefix', 'proxy', 'debug' => see correspondant property to get more informations + * 'encoding' => The XML encoding for the requests (optional, defaults to utf-8) + * 'sslverify' => boolean, true iff SSL certificates are to be verified against local cert database (optional, default false) + * 'connectionTimeout' => Timeout, in seconds, for the XML-RPC HTTP request (optional, default is no timeout) + * 'httpRequest' => Preconfigured HTTP_Request2 instance to be used in executing the XML-RPC calls (optional) + * + * @param string URI for the XML-RPC server + * @param array (optional) Associative array of options + */ + protected function __construct($uri, $options = array()) + { + if (!$uriParse = parse_url($uri)) { + throw new XML_RPC2_InvalidUriException(sprintf('Client URI \'%s\' is not valid', $uri)); + } + $this->uri = $uri; + if (isset($options['prefix'])) { + if (!(XML_RPC2_ClientHelper::testMethodName($options['prefix']))) { + throw new XML_RPC2_InvalidPrefixException(sprintf('Prefix \'%s\' is not valid', $options['prefix'])); + } + $this->prefix = $options['prefix']; + } + if (isset($options['proxy'])) { + if (!$proxyParse = parse_url($options['proxy'])) { + throw new XML_RPC2_InvalidProxyException(sprintf('Proxy URI \'%s\' is not valid', $options['proxy'])); + } + $this->proxy = $options['proxy']; + } + if (isset($options['debug'])) { + if (!(is_bool($options['debug']))) { + throw new XML_RPC2_InvalidDebugException(sprintf('Debug \'%s\' is not valid', $options['debug'])); + } + $this->debug = $options['debug']; + } + if (isset($options['encoding'])) { + // TODO : control & exception + $this->encoding = $options['encoding']; + } + if (isset($options['escaping'])) { + // TODO : control & exception + $this->escaping = $options['escaping']; + } + if (isset($options['uglyStructHack'])) { + $this->uglyStructHack = $options['uglyStructHack']; + } + if (isset($options['sslverify'])) { + if (!(is_bool($options['sslverify']))) { + throw new XML_RPC2_InvalidSslverifyException(sprintf('SSL verify \'%s\' is not valid', $options['sslverify'])); + } + $this->sslverify = $options['sslverify']; + } + if (isset($options['connectionTimeout'])) { + if (!(is_int($options['connectionTimeout']))) { + throw new XML_RPC2_InvalidConnectionTimeoutException(sprintf('Connection timeout \'%s\' is not valid', $options['connectionTimeout'])); + } + $this->connectionTimeout = $options['connectionTimeout']; + } + if (isset($options['httpRequest'])) { + $this->httpRequest = $options['httpRequest']; + } + } + + // }}} + // {{{ create() + + /** + * Factory method to select, create and return a XML_RPC2_Client backend + * + * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). + * + * Optionally, some options may be set. + * + * @param string URI for the XML-RPC server + * @param array (optional) associative array of options (see constructor) + */ + public static function create($uri, $options = array()) + { + if (isset($this)) { // Method called non-statically forward to remote call() as RPC + $this->__call('create', func_get_args()); + } + if (isset($options['backend'])) { + XML_RPC2_Backend::setBackend($options['backend']); + } + $backend = XML_RPC2_Backend::getClientClassname(); + return new $backend($uri, $options); + } + + // }}} + // {{{ __call() + + /** + * __call Catchall. This method catches remote method calls and provides for remote forwarding. + * + * If the parameters are native types, this method will use XML_RPC_Value::createFromNative to + * convert it into an XML-RPC type. Whenever a parameter is already an instance of XML_RPC_Value + * it will be used as provided. It follows that, in situations when XML_RPC_Value::createFromNative + * proves inacurate -- as when encoding DateTime values -- you should present an instance of + * XML_RPC_Value in lieu of the native parameter. + * + * @param string Method name + * @param array Parameters + * @return mixed The call result, already decoded into native types + */ + public abstract function __call($methodName, $parameters); + + // }}} +} + diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Exception.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Exception.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Exception.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Exception.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,360 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +/** + * XML_RPC2 base exception class. All XML_RPC2 originated exceptions inherit from XML_RPC2_Exception + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Exception extends Exception +{ +} + +/* Encoding and decoding values exceptions {{{ +/** + * XML_RPC2_InvalidTypeException is thrown whenever an invalid XML_RPC type is used in an operation + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidTypeException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidTypeException is thrown when creating DateTime value objects from invalid string datetime representations + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidDateFormatException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_EncodeException is thrown whenever a class is asked to encode itself in XML with invalid or not enough data. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_EncodeException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_DecodeException is thrown whenever there is a problem decoding transport XML + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_DecodeException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidTypeEncodeException is thrown whenever a class is asked to encode itself and provided a PHP type + * that can't be translated to XML_RPC + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidTypeEncodeException extends XML_RPC2_Exception +{ +} +/* }}} */ + +/** + * XML_RPC2_InvalidUriException is thrown whenever the XML_RPC2 client is asked to use an invalid uri + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidUriException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidPrefixException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC prefix + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidPrefixException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidPrefixException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC debug flag + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidDebugException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidSslverifyException is thrown whenever the XML_RPC2 client is asked to use an invalid XML/RPC SSL verify flag + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidSslverifyException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_InvalidConnectionTimeoutException is thrown whenever the XML_RPC2 + * client is asked to use an invalid XML/RPC connection timeout value + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_InvalidConnectionTimeoutException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_FaultException signals a XML-RPC response that contains a fault element instead of a regular params element. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_FaultException extends XML_RPC2_Exception +{ + + // {{{ properties + + /** + * Fault code (in the response body) + * + * @var string + */ + protected $faultCode = null; + + // }}} + // {{{ constructor + + /** Construct a new XML_RPC2_FaultException with a given message string and fault code + * + * @param string The message string, corresponding to the faultString present in the response body + * @param string The fault code, corresponding to the faultCode in the response body + */ + function __construct($messageString, $faultCode) + { + parent::__construct($messageString); + $this->faultCode = $faultCode; + } + + // }}} + // {{{ getFaultCode() + + /** + * FaultCode getter + * + * @return string fault code + */ + public function getFaultCode() + { + return $this->faultCode; + } + + // }}} + // {{{ getFaultString() + + /** + * FaultString getter + * + * This is an alias to getMessage() in order to respect XML-RPC nomenclature for faults + * + * @return string fault code + */ + public function getFaultString() + { + return $this->getMessage(); + } + + // }}} + // {{{ createFromDecode() + + /** + * Create a XML_RPC2_FaultException by decoding the corresponding xml string + * + * @param string $xml + * @return object a XML_RPC2_FaultException + */ + public static function createFromDecode($xml) { + require_once 'XML/RPC2/Backend/Php/Value.php'; + + // This is the only way I know of creating a new Document rooted in the provided simpleXMLFragment (needed for the xpath expressions that does not segfault sometimes + $xml = simplexml_load_string($xml->asXML()); + $struct = XML_RPC2_Backend_Php_Value::createFromDecode($xml->value)->getNativeValue(); + if (!(is_array($struct) && + array_key_exists('faultString', $struct) && + array_key_exists('faultCode', $struct))) throw new XML_RPC2_DecodeException('Unable to decode XML-RPC fault payload'); + + return new XML_RPC2_FaultException( $struct['faultString'], $struct['faultCode'] ); + } + + // }}} + +} + +/** + * XML_RPC2_UnknownMethodException is thrown when a non-existent method is remote-called + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_UnknownMethodException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_TransportException signal transport level exceptions that stop requests from reaching the server + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_TransportException extends XML_RPC2_Exception +{ +} + +/** + * XML_RPC2_ReceivedInvalidStatusCodeExceptionextends is thrown whenever the XML_RPC2 response to a request does not return a 200 http status code. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_ReceivedInvalidStatusCodeException extends XML_RPC2_TransportException +{ +} + +/** + * XML_RPC2_CurlException is thrown whenever an error is reported by the low level HTTP cURL library + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_CurlException extends XML_RPC2_TransportException +{ +} + +/** + * XML_RPC2_ConfigException is thrown whenever PHP config clashes with XML_RPC2 requirements or config + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_ConfigException extends XML_RPC2_Exception +{ +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Class.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Class.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Class.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Class.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,150 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Server/Method.php'; +require_once 'XML/RPC2/Server/CallHandler.php'; +// }}} + +/** + * This class is a server call handler which exposes a classe's static public methods. + * + * XML_RPC2_Server_Callhandler_Class is the preferred call handler to use when you are + * designing your XML-RPC server from the ground up. Usage is quite simple: + * - Create a class holding all of the XML-RPC server's exported procedures as public static methods (the interface class). + * - PhpDoc the classes' methods, including at least method signature (params and return types) and short description. + * - Use the XML_RPC2 factory method to create a server based on the interface class. + * A simple example: + * + * /** + * * echoecho echoes the message received + * * + * * @param string Message + * * @return string The echo + * {@*} + * class EchoServer { + * public static function echoecho($string) + * { + * return $string; + * } + * } + * + * require_once 'XML/RPC2/Server.php'; + * $server = XML_RPC2_Server::create('EchoServer'); + * $server->handleCall(); + * + * + * Use this call handler if you have designed your xml-rpc external interface as a set of + * public class methods on a given class. If, on the other hand, you intend to export an + * already existing class, it may be that not all of the methods you want to export are static. + * In that case, it is probably best to use XML_RPC2_Server_Callhandler_Instance instead. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + * @see XML_RPC2_Server::create + * @see XML_RPC2_Server_Callhandler_Instance + */ +class XML_RPC2_Server_Callhandler_Class extends XML_RPC2_Server_CallHandler +{ + + // {{{ properties + + /** + * name of target class + * + * @var string + */ + private $_className; + + // }}} + // {{{ constructor + + /** + * XML_RPC2_Server_Callhandler_Class Constructor. Creates a new call handler exporting the give static class' methods + * + * Before using this constructor, take a look at XML_RPC2_Server::create. The factory + * method is usually a quicker way of instantiating the server and its call handler. + * + * @see XML_RPC2_Server::create() + * @param string The Target class. Calls will be made on this class + * @param string Default prefix to prepend to all exported methods (defaults to '') + */ + public function __construct($className, $defaultPrefix) + { + $this->_className = $className; + $reflection = new ReflectionClass($className); + foreach ($reflection->getMethods() as $method) { + if ($method->isStatic() && $method->isPublic() && !$method->isAbstract() && !$method->isConstructor()) + { + $candidate = new XML_RPC2_Server_Method($method, $defaultPrefix); + if (!$candidate->isHidden()) $this->addMethod($candidate); + } + } + } + + // }}} + // {{{ __call() + + /** + * __call catchall. Delegate the method call to the target class, and return its result + * + * @param string Name of method to call + * @param array Array of parameters for call + * @return mixed Whatever the target method returned + */ + public function __call($methodName, $parameters) + { + if (!array_key_exists($methodName, $this->getMethods())) { + throw new XML_RPC2_UnknownMethodException("Method $methodName is not exported by this server"); + } + return call_user_func_array(array($this->_className, $this->getMethod($methodName)->getInternalMethod()), $parameters); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Instance.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Instance.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Instance.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler/Instance.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,148 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Server/Method.php'; +require_once 'XML/RPC2/Server/CallHandler.php'; +// }}} + +/** + * This class is a server call handler which exposes an instance's public methods. + * + * XML_RPC2_Server_Callhandler_Instance is the preferred call handler to use when + * you just need to quickly expose an already existing object. If designing a remote + * API from the ground up, it's best to use XML_RPC2_Server_Callhandler_Class instead. + * + * Usage is simple: + * - PhpDoc the methods, including at least method signature (params and return types) and short description. + * - Use the XML_RPC2 factory method to create a server based on the interface class. + * A simple example: + * + * class EchoServer { + * /** + * * Echo the message + * * + * * @param string The string to echo + * * @return string The echo + * {@*} + * public function echoecho($string) + * { + * return $string; + * } + * } + * + * require_once 'XML/RPC2/Server.php'; + * $someInstance = new EchoServer(); + * $server = XML_RPC2_Server::create($someInstance); + * $server->handleCall(); + * + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + * @see XML_RPC2_Server::create + * @see XML_RPC2_Server_Callhandler_Class + */ +class XML_RPC2_Server_Callhandler_Instance extends XML_RPC2_Server_CallHandler +{ + + // {{{ properties + + /** + * instance of target object + * + * @var mixed + */ + private $_instance; + + // }}} + // {{{ constructor + + /** + * XML_RPC2_Server_Callhandler_Class Constructor. Creates a new call handler exporting the given object methods + * + * Before using this constructor, take a look at XML_RPC2_Server::create. The factory + * method is usually a quicker way of instantiating the server and its call handler. + * + * @see XML_RPC2_Server::create() + * @param object The Target object. Calls will be made on this instance + * @param string Default prefix to prepend to all exported methods (defaults to '') + */ + public function __construct($instance, $defaultPrefix) + { + $this->_instance = $instance; + $reflection = new ReflectionClass(get_class($instance)); + foreach ($reflection->getMethods() as $method) { + if (!$method->isStatic() && $method->isPublic() && !$method->isConstructor()) + { + $candidate = new XML_RPC2_Server_Method($method, $defaultPrefix); + if (!$candidate->isHidden()) $this->addMethod($candidate); + } + } + } + + // }}} + // {{{ __call() + + /** + * __call catchall. Delegate the method call to the target object, and return its result + * + * @param string Name of method to call + * @param array Array of parameters for call + * @return mixed Whatever the target method returned + */ + public function __call($methodName, $parameters) + { + if (!array_key_exists($methodName, $this->getMethods())) { + throw new XML_RPC2_UnknownMethodException("Method $methodName is not exported by this server"); + } + return call_user_func_array(array($this->_instance, $this->getMethod($methodName)->getInternalMethod()), $parameters); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/CallHandler.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,129 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +// }}} + +/** + * A CallHandler is responsible for actually calling the server-exported methods from the exported class. + * + * This class is abstract and not meant to be used directly by XML_RPC2 users. + * + * XML_RPC2_Server_CallHandler provides the basic code for a call handler class. An XML_RPC2 Call Handler + * operates in tandem with an XML_RPC2 server to export a classe's methods. While XML_RPC2 Server + * is responsible for request decoding and response encoding, the Call Handler is responsible for + * delegating the actual method call to the intended target. + * + * Different server behaviours can be obtained by plugging different Call Handlers into the XML_RPC2_Server. + * Namely, there are two call handlers available: + * - XML_RPC2_Server_Callhandler_Class: Which exports a classe's public static methods + * - XML_RPC2_Server_Callhandler_Instance: Which exports an object's pubilc methods + * + * @see XML_RPC2_Server_Callhandler_Class + * @see XML_RPC2_Server_Callhandler_Instance + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Server_CallHandler +{ + + // {{{ properties + + /** + * methods Field : holds server methods + * + * @var array + */ + protected $methods = array(); + + // }}} + // {{{ getMethods() + + /** + * methods getter + * + * @return array Array of XML_RPC2_Server_Method instances + */ + public function getMethods() + { + return $this->methods; + } + + // }}} + // {{{ addMethod() + + /** + * method appender + * + * @param XML_RPC2_Server_Method Method to append to methods + */ + protected function addMethod(XML_RPC2_Server_Method $method) + { + $this->methods[$method->getName()] = $method; + } + + // }}} + // {{{ getMethod() + + /** + * method getter + * + * @param string Name of method to return + * @param XML_RPC2_Server_Method Method named $name + */ + public function getMethod($name) + { + if (isset($this->methods[$name])) { + return $this->methods[$name]; + } + return false; + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input/PhpInput.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input/PhpInput.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input/PhpInput.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input/PhpInput.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,82 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// Dependencies {{{ +require_once('XML/RPC2/Server/Input.php'); +// }}} + +/** + * Class that feeds XML_RPC2 with input originating from php://input + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2011 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Server_Input_PhpInput implements XML_RPC2_Server_Input +{ + protected $input; + /** + * Return true if there is no input (input is empty) + * + * @return boolean True iff there is no input + */ + public function isEmpty() + { + if (!isset($this->input)) $this->readRequest(); + return empty($this->input); + } + /** + * Return the input as a string + * + * @return string The Input + */ + public function readRequest() + { + if (!isset($this->input)) { + $this->input = file_get_contents('php://input'); + } + + return $this->input; + } +} + diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input/RawPostData.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input/RawPostData.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input/RawPostData.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input/RawPostData.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,82 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// Dependencies {{{ +require_once('XML/RPC2/Server/Input.php'); +require_once('XML/RPC2/Exception.php'); +// }}} + +/** + * Class that feeds XML_RPC2 with input originating from + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2011 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Server_Input_RawPostData implements XML_RPC2_Server_Input +{ + protected $input; + /** + * Return true if there is no input (input is empty) + * + * @return boolean True iff there is no input + */ + public function isEmpty() + { + if (!isset($this->input)) $this->readRequest(); + $result = empty($this->input); + return $result; + } + /** + * Return the input as a string + * + * @return string The Input + */ + public function readRequest() + { + if (!isset($this->input) && !isset($GLOBALS['HTTP_RAW_POST_DATA'])) throw new XML_RPC2_ConfigException('XML_RPC2_Server_Input_RawPostData requested but PHP config does not show GLOBALS[\'HTTP_RAW_POST_DATA\'] as available'); + if (!isset($this->input)) $this->input = $GLOBALS['HTTP_RAW_POST_DATA']; + + return $this->input; + } +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Input.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Input.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,68 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id: Method.php 295362 2010-02-22 07:17:31Z clockwerx $ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +/** + * Interface for feeding input to an XML_RPC2_Server + * + * Classes to be used as input readers for XML_RPC2_Server instances + * should implement this interface + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2011 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +interface XML_RPC2_Server_Input +{ + /** + * Return true if there is no input (input is empty) + * + * @return boolean True iff there is no input + */ + public function isEmpty(); + /** + * Return the input as a string + * + * @return string The Input + */ + public function readRequest(); +} diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Method.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Method.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server/Method.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server/Method.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,391 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +// }}} + +/** + * Class representing an XML-RPC exported method. + * + * This class is used internally by XML_RPC2_Server. External users of the + * package should not need to ever instantiate XML_RPC2_Server_Method + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Server_Method +{ + // {{{ properties + + /** + * Method signature parameters + * + * @var array + */ + private $_parameters; + + /** + * Method signature return type + * + * @var string + */ + private $_returns ; + + /** + * Method help, for introspection + * + * @var string + */ + private $_help; + + /** + * internalMethod field : method name in PHP-land + * + * @var string + */ + private $_internalMethod; + + /** + * hidden field : true if the method is hidden + * + * @var boolean + */ + private $_hidden; + + /** + * name Field : external method name + * + * @var string + */ + private $_name; + + /** + * Number of required parameters + * + * @var int + */ + private $_numberOfRequiredParameters; + + // }}} + // {{{ getInternalMethod() + + /** + * internalMethod getter + * + * @return string internalMethod + */ + public function getInternalMethod() + { + return $this->_internalMethod; + } + + // }}} + // {{{ isHidden() + + /** + * hidden getter + * + * @return boolean hidden value + */ + public function isHidden() + { + return $this->_hidden; + } + + // }}} + // {{{ getName() + + /** + * name getter + * + * @return string name + */ + public function getName() + { + return $this->_name; + } + + // }}} + // {{{ constructor + + /** + * Create a new XML-RPC method by introspecting a PHP method + * + * @param ReflectionMethod The PHP method to introspect + * @param string default prefix + */ + public function __construct(ReflectionMethod $method, $defaultPrefix) + { + $hidden = false; + $docs = $method->getDocComment(); + if (!$docs) { + $hidden = true; + } + $docs = explode("\n", $docs); + + $parameters = array(); + $methodname = null; + $returns = 'mixed'; + $shortdesc = ''; + $paramcount = -1; + $prefix = $defaultPrefix; + + // Extract info from Docblock + $paramDocs = array(); + foreach ($docs as $i => $doc) { + $doc = trim($doc, " \r\t/*"); + if (strlen($doc) && strpos($doc, '@') !== 0) { + if ($shortdesc) { + $shortdesc .= "\n"; + } + $shortdesc .= $doc; + continue; + } + if (strpos($doc, '@xmlrpc.hidden') === 0) { + $hidden = true; + } + if ((strpos($doc, '@xmlrpc.prefix') === 0) && preg_match('/@xmlrpc.prefix( )*(.*)/', $doc, $matches)) { + $prefix = $matches[2]; + } + if ((strpos($doc, '@xmlrpc.methodname') === 0) && preg_match('/@xmlrpc.methodname( )*(.*)/', $doc, $matches)) { + $methodname = $matches[2]; + } + if (strpos($doc, '@param') === 0) { // Save doctag for usage later when filling parameters + $paramDocs[] = $doc; + } + + if (strpos($doc, '@return') === 0) { + $param = preg_split("/\s+/", $doc); + if (isset($param[1])) { + $param = $param[1]; + $returns = $param; + } + } + } + $this->_numberOfRequiredParameters = $method->getNumberOfRequiredParameters(); // we don't use isOptional() because of bugs in the reflection API + // Fill in info for each method parameter + foreach ($method->getParameters() as $parameterIndex => $parameter) { + // Parameter defaults + $newParameter = array('type' => 'mixed'); + + // Attempt to extract type and doc from docblock + if (array_key_exists($parameterIndex, $paramDocs) && + preg_match('/@param\s+(\S+)(\s+(.+))/', $paramDocs[$parameterIndex], $matches)) { + if (strpos($matches[1], '|')) { + $newParameter['type'] = XML_RPC2_Server_Method::_limitPHPType(explode('|', $matches[1])); + } else { + $newParameter['type'] = XML_RPC2_Server_Method::_limitPHPType($matches[1]); + } + $tmp = '$' . $parameter->getName() . ' '; + if (strpos($matches[3], '$' . $tmp) === 0) { + $newParameter['doc'] = $matches[3]; + } else { + // The phpdoc comment is something like "@param string $param description of param" + // Let's keep only "description of param" as documentation (remove $param) + $newParameter['doc'] = substr($matches[3], strlen($tmp)); + } + $newParameter['doc'] = preg_replace('_^\s*_', '', $newParameter['doc']); + } + + $parameters[$parameter->getName()] = $newParameter; + } + + if (is_null($methodname)) { + $methodname = $prefix . $method->getName(); + } + + $this->_internalMethod = $method->getName(); + $this->_parameters = $parameters; + $this->_returns = $returns; + $this->_help = $shortdesc; + $this->_name = $methodname; + $this->_hidden = $hidden; + } + + // }}} + // {{{ matchesSignature() + + /** + * Check if method matches provided call signature + * + * Compare the provided call signature with this methods' signature and + * return true iff they match. + * + * @param string Signature to compare method name + * @param array Array of parameter values for method call. + * @return boolean True if call matches signature, false otherwise + */ + public function matchesSignature($methodName, $callParams) + { + if ($methodName != $this->_name) return false; + if (count($callParams) < $this->_numberOfRequiredParameters) return false; + if (count($callParams) > $this->_parameters) return false; + $paramIndex = 0; + foreach($this->_parameters as $param) { + $paramIndex++; + if ($paramIndex <= $this->_numberOfRequiredParameters) { + // the parameter is not optional + $callParamType = XML_RPC2_Server_Method::_limitPHPType(gettype($callParams[$paramIndex-1])); + if ((!($param['type'] == 'mixed')) and ($param['type'] != $callParamType)) { + return false; + } + } + } + return true; + } + + // }}} + // {{{ getHTMLSignature() + + /** + * Return a HTML signature of the method + * + * @return string HTML signature + */ + public function getHTMLSignature() + { + $name = $this->_name; + $returnType = $this->_returns; + $result = "($returnType) "; + $result .= "$name"; + $result .= "("; + $first = true; + $nbr = 0; + while (list($name, $parameter) = each($this->_parameters)) { + $nbr++; + if ($nbr == $this->_numberOfRequiredParameters + 1) { + $result .= " [ "; + } + if ($first) { + $first = false; + } else { + $result .= ', '; + } + $type = $parameter['type']; + $result .= "($type) "; + $result .= "$name"; + } + reset($this->_parameters); + if ($nbr > $this->_numberOfRequiredParameters) { + $result .= " ] "; + } + $result .= ")"; + return $result; + } + + // }}} + // {{{ autoDocument() + /** + * Print a complete HTML description of the method + */ + public function autoDocument() + { + $name = $this->getName(); + $signature = $this->getHTMLSignature(); + $id = md5($name); + $help = nl2br(htmlentities($this->_help)); + print "

$signature

\n"; + print "

Description :

\n"; + print "
\n"; + print " $help\n"; + print "
\n"; + if (count($this->_parameters)>0) { + print "

Parameters :

\n"; + if (count($this->_parameters)>0) { + print " \n"; + print " \n"; + while (list($name, $parameter) = each($this->_parameters)) { + $type = $parameter['type']; + $doc = isset($parameter['doc']) ? htmlentities($parameter['doc']) : 'Method is not documented. No PHPDoc block was found associated with the method in the source code.'; + print " \n"; + } + reset($this->_parameters); + print "
TypeNameDocumentation
$type$name$doc
\n"; + } + } + } + + // }}} + // {{{ _limitPHPType() + /** + * standardise type names between gettype php function and phpdoc comments (and limit to xmlrpc available types) + * + * @var string $type + * @return string standardised type + */ + private static function _limitPHPType($type) + { + $tmp = strtolower($type); + $convertArray = array( + 'int' => 'integer', + 'i4' => 'integer', + 'integer' => 'integer', + 'string' => 'string', + 'str' => 'string', + 'char' => 'string', + 'bool' => 'boolean', + 'boolean' => 'boolean', + 'array' => 'array', + 'float' => 'double', + 'double' => 'double', + 'array' => 'array', + 'struct' => 'array', + 'assoc' => 'array', + 'structure' => 'array', + 'datetime' => 'mixed', + 'datetime.iso8601' => 'mixed', + 'iso8601' => 'mixed', + 'base64' => 'string' + ); + if (isset($convertArray[$tmp])) { + return $convertArray[$tmp]; + } + return 'mixed'; + } + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Server.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Server.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,355 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend.php'; +require_once 'XML/RPC2/Server/Input.php'; +// }}} + + +/** + * XML_RPC2_Server is the frontend class for exposing PHP functions via XML-RPC. + * + * Exporting a programatic interface via XML-RPC using XML_RPC2 is exceedingly easy: + * + * The first step is to assemble all methods you wish to export into a class. You may either + * create a (abstract) class with exportable methods as static, or use an existing instance + * of an object. + * + * You'll then need to document the methods using PHPDocumentor tags. XML_RPC2 will use the + * documentation for server introspection. You'll get something like this: + * + * + * class ExampleServer { + * /** + * * hello says hello + * * + * * @param string Name + * * @return string Greetings + * {@*} + * public static function hello($name) + { + * return "Hello $name"; + * } + * } + * + * + * Now, instantiate the server, using the Factory method to select a backend and a call handler for you: + * + * require_once 'XML/RPC2/Server.php'; + * $server = XML_RPC2_Server::create('ExampleServer'); + * $server->handleCall(); + * + * + * This will create a server exporting all of the 'ExampleServer' class' methods. If you wish to export + * instance methods as well, pass an object instance to the factory instead: + * + * require_once 'XML/RPC2/Server.php'; + * $server = XML_RPC2_Server::create(new ExampleServer()); + * $server->handleCall(); + * + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Server +{ + + // {{{ properties + + /** + * callHandler field + * + * The call handler is responsible for executing the server exported methods + * + * @var mixed + */ + protected $callHandler = null; + + /** + * prefix field + * + * @var string + */ + protected $prefix = ''; + + /** + * encoding field + * + * TODO : work on encoding for this backend + * + * @var string + */ + protected $encoding = 'utf-8'; + + /** + * display html documentation of xmlrpc exported methods when there is no post datas + * + * @var boolean + */ + protected $autoDocument = true; + + /** + * display external links at the end of autodocumented page + * + * @var boolean + */ + protected $autoDocumentExternalLinks = true; + + /** + * signature checking flag + * + * if set to true, the server will check the method signature before + * calling the corresponding php method + * + * @var boolean + */ + protected $signatureChecking = true; + + /** + * input handler + * + * Implementation of XML_RPC2_Server_Input that feeds this server with input + * + * @var XML_RPC2_Server_Input + */ + protected $input; + + // }}} + // {{{ constructor + + /** + * Create a new XML-RPC Server. + * + * @param object $callHandler the call handler will receive a method call for each remote call received. + * @param array associative array of options + */ + protected function __construct($callHandler, $options = array()) + { + $this->callHandler = $callHandler; + if ((isset($options['prefix'])) && (is_string($options['prefix']))) { + $this->prefix = $options['prefix']; + } + if ((isset($options['encoding'])) && (is_string($options['encoding']))) { + $this->encoding = $options['encoding']; + } + if ((isset($options['autoDocument'])) && (is_bool($options['autoDocument']))) { + $this->autoDocument = $options['autoDocument']; + } + if ((isset($options['autoDocumentExternalLinks'])) && (is_bool($options['autoDocumentExternalLinks']))) { + $this->autoDocumentExternalLinks = $options['autoDocumentExternalLinks']; + } + if ((isset($options['signatureChecking'])) && (is_bool($options['signatureChecking']))) { + $this->signatureChecking = $options['signatureChecking']; + } + if (!isset($options['input'])) $options['input'] = 'XML_RPC2_Server_Input_RawPostData'; + if (is_string($options['input'])) { + $inputDir = strtr($options['input'], array('_' => DIRECTORY_SEPARATOR)) . '.php'; + require_once($inputDir); + $inputClass = $options['input']; + + $options['input'] = new $inputClass(); + } + if ($options['input'] instanceof XML_RPC2_Server_Input) { + $this->input = $options['input']; + } else { + throw new XML_RPC2_ConfigException('Invalid value for "input" option. It must be either a XML_RPC2_Server_Input subclass name or XML_RPC2_Server_Input subclass instance'); + } + } + + // }}} + // {{{ create() + + /** + * Factory method to select a backend and return a new XML_RPC2_Server based on the backend + * + * @param mixed $callTarget either a class name or an object instance. + * @param array associative array of options + * @return object a server class instance + */ + public static function create($callTarget, $options = array()) + { + if (isset($options['backend'])) { + XML_RPC2_Backend::setBackend($options['backend']); + } + if (isset($options['prefix'])) { + $prefix = $options['prefix']; + } else { + $prefix = ''; + } + $backend = XML_RPC2_Backend::getServerClassname(); + // Find callHandler class + if (!isset($options['callHandler'])) { + if (is_object($callTarget)) { // Delegate calls to instance methods + require_once 'XML/RPC2/Server/CallHandler/Instance.php'; + $callHandler = new XML_RPC2_Server_CallHandler_Instance($callTarget, $prefix); + } else { // Delegate calls to static class methods + require_once 'XML/RPC2/Server/CallHandler/Class.php'; + $callHandler = new XML_RPC2_Server_CallHandler_Class($callTarget, $prefix); + } + } else { + $callHandler = $options['callHandler']; + } + return new $backend($callHandler, $options); + } + + // }}} + // {{{ handleCall() + + /** + * Receive the XML-RPC request, decode the HTTP payload, delegate execution to the call handler, and output the encoded call handler response. + * + */ + public abstract function handleCall(); + + // }}} + // {{{ errorToException() + + /** + * Transform an error into an exception + * + * @param int $errno error number + * @param string $errstr error string + * @param string $errfile error file + * @param int $errline error line + */ + public static function errorToException($errno, $errstr, $errfile, $errline) + { + switch ($errno) { + case E_WARNING: + case E_NOTICE: + case E_USER_WARNING: + case E_USER_NOTICE: + case E_STRICT: + // Silence warnings + // TODO Logging should occur here + break; + default: + throw new Exception('Classic error reported "' . $errstr . '" on ' . $errfile . ':' . $errline); + } + } + + // }}} + // {{{ autoDocument() + /* autoDocument {{{ */ + /** + * autoDocument. Produce an HTML page from the result of server introspection + * + * @return string HTML document describing this server + */ + public function autoDocument() + /* }}} */ + { + print "\n"; + print "\n"; + print " \n"; + print " \n"; + print " Available XMLRPC methods for this server\n"; + print " \n"; + print " \n"; + print " \n"; + print "

Available XMLRPC methods for this server

\n"; + print "

Index

\n"; + print "
    \n"; + foreach ($this->callHandler->getMethods() as $method) { + $name = $method->getName(); + $id = md5($name); + $signature = $method->getHTMLSignature(); + print "
  • $name()
  • \n"; + } + print "
\n"; + print "

Details

\n"; + foreach ($this->callHandler->getMethods() as $method) { + print "
\n"; + $method->autoDocument(); + print "

(return to index)

\n"; + print "
\n"; + } + if (!($this->autoDocumentExternalLinks)) { + print '

Powered by PEAR/XML_RPC2       Valid XHTML 1.0 Strict       Valid CSS!

' . "\n"; + } + print " \n"; + print "\n"; + } + // }}} + // {{{ getContentLength() + + /** + * Gets the content legth of a serialized XML-RPC message in bytes + * + * @param string $content the serialized XML-RPC message. + * + * @return integer the content length in bytes. + */ + protected function getContentLength($content) + { + if (extension_loaded('mbstring') && (ini_get('mbstring.func_overload') & 2) == 2) { + $length = mb_strlen($content, '8bit'); + } else { + $length = strlen((binary)$content); + } + + return $length; + } + + // }}} +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Util/HTTPRequest.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Util/HTTPRequest.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Util/HTTPRequest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Util/HTTPRequest.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,248 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Client.php'; +require_once 'HTTP/Request2.php'; +// }}} + +/** + * XML_RPC utility HTTP request class. This class mimics a subset of PEAR's HTTP_Request + * and is to be refactored out of the package once HTTP_Request releases an E_STRICT version. + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2011 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +class XML_RPC2_Util_HTTPRequest +{ + + // {{{ properties + + /** + * proxy field + * + * @var string + */ + private $_proxy = null; + + /** + * proxyauth field + * + * @var string + */ + private $_proxyAuth = null; + + /** + * postData field + * + * @var string + */ + private $_postData; + + /** + * uri field + * + * @var array + */ + private $_uri; + + /** + * encoding for the request + * + * @var string + */ + private $_encoding='utf-8'; + + /** + * SSL verify flag + * + * @var boolean + */ + private $_sslverify=true; + + /** + * HTTP timeout length in seconds. + * + * @var integer + */ + private $_connectionTimeout = null; + + /** + * HTTP_Request2 backend + * + * @var integer + */ + private $_httpRequest = null; + + // }}} + // {{{ getBody() + + /** + * body field getter + * + * @return string body value + */ + public function getBody() + { + return $this->_body; + } + + // }}} + // {{{ setPostData() + + /** + * postData field setter + * + * @param string postData value + */ + public function setPostData($value) + { + $this->_postData = $value; + } + + // }}} + // {{{ constructor + + /** + * Constructor + * + * Sets up the object + * @param string The uri to fetch/access + * @param array Associative array of parameters which can have the following keys: + *
    + *
  • proxy - Proxy (string)
  • + *
  • encoding - The request encoding (string)
  • + *
  • sslverify
  • - The SSL verify flag (boolean) + *
  • connectionTimeout
  • - The connection timeout in milliseconds (integer) + *
  • httpRequest
  • - Preconfigured instance of HTTP_Request2 (optional) + *
+ * @access public + */ + public function __construct($uri = '', $params = array()) + { + if (!preg_match('/(https?:\/\/)(.*)/', $uri)) throw new XML_RPC2_Exception('Unable to parse URI'); + $this->_uri = $uri; + if (isset($params['encoding'])) { + $this->_encoding = $params['encoding']; + } + if (isset($params['proxy'])) { + $proxy = $params['proxy']; + $elements = parse_url($proxy); + if (is_array($elements)) { + if ((isset($elements['scheme'])) and (isset($elements['host']))) { + $this->_proxy = $elements['scheme'] . '://' . $elements['host']; + } + if (isset($elements['port'])) { + $this->_proxy = $this->_proxy . ':' . $elements['port']; + } + if ((isset($elements['user'])) and (isset($elements['pass']))) { + $this->_proxyAuth = $elements['user'] . ':' . $elements['pass']; + } + } + } + if (isset($params['sslverify'])) { + $this->_sslverify = $params['sslverify']; + } + if (isset($params['connectionTimeout'])) { + $this->_connectionTimeout = $params['connectionTimeout']; + } + if (isset($params['httpRequest']) && $params['httpRequest'] instanceof HTTP_Request2) { + $this->_httpRequest = $params['httpRequest']; + } + } + + // }}} + // {{{ sendRequest() + + /** + * Sends the request + * + * @access public + * @return mixed PEAR error on error, true otherwise + */ + public function sendRequest() + { + if (is_null($this->_httpRequest)) $this->_httpRequest = new HTTP_Request2($this->_uri, HTTP_Request2::METHOD_POST); + $request = $this->_httpRequest; + $request->setUrl($this->_uri); + $request->setMethod(HTTP_Request2::METHOD_POST); + if (isset($params['proxy'])) { + $elements = parse_url($params['proxy']); + if (is_array($elements)) { + if ((isset($elements['scheme'])) and (isset($elements['host']))) { + $request->setConfig('proxy_host', $elements['host']); + } + if (isset($elements['port'])) { + $request->setConfig('proxy_port', $elements['port']); + } + if ((isset($elements['user'])) and (isset($elements['pass']))) { + $request->setConfig('proxy_user', $elements['user']); + $request->setConfig('proxy_password', $elements['pass']); + } + } + } + $request->setConfig('ssl_verify_peer', $this->_sslverify); + $request->setConfig('ssl_verify_host', $this->_sslverify); + $request->setHeader('Content-type: text/xml; charset='.$this->_encoding); + $request->setHeader('User-Agent: PEAR::XML_RPC2/@package_version@'); + $request->setBody($this->_postData); + if (isset($this->_connectionTimeout)) $request->setConfig('timeout', (int) ($this->_connectionTimeout / 1000)); + try { + $result = $request->send(); + if ($result->getStatus() != 200) throw new XML_RPC2_ReceivedInvalidStatusCodeException('Received non-200 HTTP Code: ' . $result->getStatus() . '. Response body:' . $result->getBody()); + + } catch (HTTP_Request2_Exception $e) { + throw new XML_RPC2_CurlException($e); + } + $this->_body = $result->getBody(); + return $result->getBody(); + } + + // }}} + +} + +?> diff -Nru php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Value.php php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Value.php --- php-xml-rpc2-1.1.2/XML_RPC2-1.1.3/XML/RPC2/Value.php 1970-01-01 00:00:00.000000000 +0000 +++ php-xml-rpc2-1.1.3/XML_RPC2-1.1.3/XML/RPC2/Value.php 2016-06-21 19:29:56.000000000 +0000 @@ -0,0 +1,81 @@ + | +* +-----------------------------------------------------------------------------+ +* +* @category XML +* @package XML_RPC2 +* @author Sergio Carvalho +* @copyright 2004-2006 Sergio Carvalho +* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 +* @version CVS: $Id$ +* @link http://pear.php.net/package/XML_RPC2 +*/ + +// }}} + +// dependencies {{{ +require_once 'XML/RPC2/Exception.php'; +require_once 'XML/RPC2/Backend.php'; +// }}} + +/** + * XML_RPC value abstract class. All XML_RPC value classes inherit from XML_RPC2_Value + * + * @category XML + * @package XML_RPC2 + * @author Sergio Carvalho + * @copyright 2004-2006 Sergio Carvalho + * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 + * @link http://pear.php.net/package/XML_RPC2 + */ +abstract class XML_RPC2_Value +{ + // {{{ createFromNative() + + /** + * Factory method that constructs the appropriate XML-RPC encoded type value + * + * @param mixed Value to be encode + * @param string (optional) Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type) + * @return mixed The encoded value + */ + public static function createFromNative($value, $explicitType = null) + { + $xmlrpcTypes = array('int', 'boolean', 'string', 'double', 'datetime', 'base64', 'struct', 'array'); + if (in_array($explicitType, $xmlrpcTypes)) { + return @call_user_func(array(XML_RPC2_Backend::getValueClassname(), 'createFromNative'), $value, $explicitType); + } + return $value; + } + + // }}} + +} + +?>