From: ggiunta Date: Wed, 6 May 2009 11:40:50 +0000 (+0000) Subject: - temoved compat stuff and checks from trunk after having created the php4 branch; X-Git-Tag: 3.0.0-beta~27 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=d34b765180c60be4688af802490bb7e7909a9141 - temoved compat stuff and checks from trunk after having created the php4 branch; - update rev. number to 3.0.0.beta git-svn-id: https://svn.code.sf.net/p/phpxmlrpc/code/trunk/xmlrpc@14 013ecfd8-0664-425d-a759-9c98391dc3f9 --- diff --git a/ChangeLog b/ChangeLog index 6b241cf..3f8ca49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,17 @@ +2009-04-06 - G. Giunta (giunta.gaetano@gmail.com) + + * create php4 branch, rename trunk to 3.0.0beta - it will be the php5-only version + + * xmlrpc.inc: removed test fpr php version and inclusion of compat patches for really + really old versions of php 4 + 2009-03-16 - G. Giunta (giunta.gaetano@gmail.com) thanks Tommaso Trani * move from CVS to SVN on sf.net; file layout now is the same as in packaged lib * xmlrpc.inc: fix php warning when receiving 'false' in a bool value - * Makefile, doc/Makefile: alter to follow new file layout + * Makefile, doc/Makefile: alter to follow new file layout * tagged and released as 2.2.2 diff --git a/lib/compat/array_key_exists.php b/lib/compat/array_key_exists.php deleted file mode 100644 index 4ee07fd..0000000 --- a/lib/compat/array_key_exists.php +++ /dev/null @@ -1,55 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id$ - - -/** - * Replace array_key_exists() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_key_exists - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.0 (user_error) - */ -if (!function_exists('array_key_exists')) { - function array_key_exists($key, $search) - { - if (!is_scalar($key)) { - user_error('array_key_exists() The first argument should be either a string or an integer', - E_USER_WARNING); - return false; - } - - if (is_object($search)) { - $search = get_object_vars($search); - } - - if (!is_array($search)) { - user_error('array_key_exists() The second argument should be either an array or an object', - E_USER_WARNING); - return false; - } - - return in_array($key, array_keys($search)); - } -} - -?> \ No newline at end of file diff --git a/lib/compat/is_a.php b/lib/compat/is_a.php deleted file mode 100644 index 0d52226..0000000 --- a/lib/compat/is_a.php +++ /dev/null @@ -1,47 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id$ - - -/** - * Replace function is_a() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.is_a - * @author Aidan Lister - * @version $Revision: 1.2 $ - * @since PHP 4.2.0 - * @require PHP 4.0.0 (user_error) (is_subclass_of) - */ -if (!function_exists('is_a')) { - function is_a($object, $class) - { - if (!is_object($object)) { - return false; - } - - if (get_class($object) == strtolower($class)) { - return true; - } else { - return is_subclass_of($object, $class); - } - } -} - -?> \ No newline at end of file diff --git a/lib/compat/is_callable.php b/lib/compat/is_callable.php deleted file mode 100644 index fccc19d..0000000 --- a/lib/compat/is_callable.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @version $Id$ - * @since PHP 4.0.6 - * @require PHP 4.0.0 (true, false, etc...) - * @todo add the 3rd parameter syntax... - */ -if (!function_exists('is_callable')) { - function is_callable($var, $syntax_only=false) - { - if ($syntax_only) - { - /* from The Manual: - * If the syntax_only argument is TRUE the function only verifies - * that var might be a function or method. It will only reject simple - * variables that are not strings, or an array that does not have a - * valid structure to be used as a callback. The valid ones are - * supposed to have only 2 entries, the first of which is an object - * or a string, and the second a string - */ - return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); - } - else - { - if (is_string($var)) - { - return function_exists($var); - } - else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) - { - $obj = reset($var); - if (is_string($obj)) - { - $methods = get_class_methods($obj); - return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); - } - else if (is_object($obj)) - { - return method_exists($obj, $method); - } - } - return false; - } - } -} - -?> \ No newline at end of file diff --git a/lib/compat/is_scalar.php b/lib/compat/is_scalar.php deleted file mode 100644 index aa13682..0000000 --- a/lib/compat/is_scalar.php +++ /dev/null @@ -1,38 +0,0 @@ - \ No newline at end of file diff --git a/lib/compat/var_export.php b/lib/compat/var_export.php deleted file mode 100644 index 947210f..0000000 --- a/lib/compat/var_export.php +++ /dev/null @@ -1,105 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id$ - - -/** - * Replace var_export() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.var_export - * @author Aidan Lister - * @version $Revision: 1.2 $ - * @since PHP 4.2.0 - * @require PHP 4.0.0 (user_error) - */ -if (!function_exists('var_export')) { - function var_export($array, $return = false, $lvl=0) - { - // Common output variables - $indent = ' '; - $doublearrow = ' => '; - $lineend = ",\n"; - $stringdelim = '\''; - - // Check the export isn't a simple string / int - if (is_string($array)) { - $out = $stringdelim . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $array)) . $stringdelim; - } elseif (is_int($array) || is_float($array)) { - $out = (string)$array; - } elseif (is_bool($array)) { - $out = $array ? 'true' : 'false'; - } elseif (is_null($array)) { - $out = 'NULL'; - } elseif (is_resource($array)) { - $out = 'resource'; - } else { - // Begin the array export - // Start the string - $out = "array (\n"; - - // Loop through each value in array - foreach ($array as $key => $value) { - // If the key is a string, delimit it - if (is_string($key)) { - $key = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $key)); - $key = $stringdelim . $key . $stringdelim; - } - - $val = var_export($value, true, $lvl+1); - // Delimit value - /*if (is_array($value)) { - // We have an array, so do some recursion - // Do some basic recursion while increasing the indent - $recur_array = explode($newline, var_export($value, true)); - $temp_array = array(); - foreach ($recur_array as $recur_line) { - $temp_array[] = $indent . $recur_line; - } - $recur_array = implode($newline, $temp_array); - $value = $newline . $recur_array; - } elseif (is_null($value)) { - $value = 'NULL'; - } else { - $value = str_replace($find, $replace, $value); - $value = $stringdelim . $value . $stringdelim; - }*/ - - // Piece together the line - for ($i = 0; $i < $lvl; $i++) - $out .= $indent; - $out .= $key . $doublearrow . $val . $lineend; - } - - // End our string - for ($i = 0; $i < $lvl; $i++) - $out .= $indent; - $out .= ")"; - } - - // Decide method of output - if ($return === true) { - return $out; - } else { - echo $out; - return; - } - } -} -?> \ No newline at end of file diff --git a/lib/compat/version_compare.php b/lib/compat/version_compare.php deleted file mode 100644 index 01fc3cf..0000000 --- a/lib/compat/version_compare.php +++ /dev/null @@ -1,179 +0,0 @@ - | -// | Aidan Lister | -// +----------------------------------------------------------------------+ -// -// $Id$ - - -/** - * Replace version_compare() - * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.version_compare - * @author Philippe Jausions - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.0 (user_error) - */ -if (!function_exists('version_compare')) { - function version_compare($version1, $version2, $operator = '<') - { - // Check input - if (!is_scalar($version1)) { - user_error('version_compare() expects parameter 1 to be string, ' . - gettype($version1) . ' given', E_USER_WARNING); - return; - } - - if (!is_scalar($version2)) { - user_error('version_compare() expects parameter 2 to be string, ' . - gettype($version2) . ' given', E_USER_WARNING); - return; - } - - if (!is_scalar($operator)) { - user_error('version_compare() expects parameter 3 to be string, ' . - gettype($operator) . ' given', E_USER_WARNING); - return; - } - - // Standardise versions - $v1 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version1))))); - - $v2 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version2))))); - - // Replace empty entries at the start of the array - while (empty($v1[0]) && array_shift($v1)) {} - while (empty($v2[0]) && array_shift($v2)) {} - - // Release state order - // '#' stands for any number - $versions = array( - 'dev' => 0, - 'alpha' => 1, - 'a' => 1, - 'beta' => 2, - 'b' => 2, - 'RC' => 3, - '#' => 4, - 'p' => 5, - 'pl' => 5); - - // Loop through each segment in the version string - $compare = 0; - for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { - if ($v1[$i] == $v2[$i]) { - continue; - } - $i1 = $v1[$i]; - $i2 = $v2[$i]; - if (is_numeric($i1) && is_numeric($i2)) { - $compare = ($i1 < $i2) ? -1 : 1; - break; - } - // We use the position of '#' in the versions list - // for numbers... (so take care of # in original string) - if ($i1 == '#') { - $i1 = ''; - } elseif (is_numeric($i1)) { - $i1 = '#'; - } - if ($i2 == '#') { - $i2 = ''; - } elseif (is_numeric($i2)) { - $i2 = '#'; - } - if (isset($versions[$i1]) && isset($versions[$i2])) { - $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; - } elseif (isset($versions[$i1])) { - $compare = 1; - } elseif (isset($versions[$i2])) { - $compare = -1; - } else { - $compare = 0; - } - - break; - } - - // If previous loop didn't find anything, compare the "extra" segments - if ($compare == 0) { - if (count($v2) > count($v1)) { - if (isset($versions[$v2[$i]])) { - $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; - } else { - $compare = -1; - } - } elseif (count($v2) < count($v1)) { - if (isset($versions[$v1[$i]])) { - $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; - } else { - $compare = 1; - } - } - } - - // Compare the versions - if (func_num_args() > 2) { - switch ($operator) { - case '>': - case 'gt': - return (bool) ($compare > 0); - break; - case '>=': - case 'ge': - return (bool) ($compare >= 0); - break; - case '<=': - case 'le': - return (bool) ($compare <= 0); - break; - case '==': - case '=': - case 'eq': - return (bool) ($compare == 0); - break; - case '<>': - case '!=': - case 'ne': - return (bool) ($compare != 0); - break; - case '': - case '<': - case 'lt': - return (bool) ($compare < 0); - break; - default: - return; - } - } - - return $compare; - } -} - -?> \ No newline at end of file diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index 6bad30a..f57051a 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -45,29 +45,6 @@ } } - // Try to be backward compat with php < 4.2 (are we not being nice ?) - $phpversion = phpversion(); - if($phpversion[0] == '4' && $phpversion[2] < 2) - { - // give an opportunity to user to specify where to include other files from - if(!defined('PHP_XMLRPC_COMPAT_DIR')) - { - define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/'); - } - if($phpversion[2] == '0') - { - if($phpversion[4] < 6) - { - include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php'); - } - include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php'); - include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php'); - include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php'); - } - include(PHP_XMLRPC_COMPAT_DIR.'var_export.php'); - include(PHP_XMLRPC_COMPAT_DIR.'is_a.php'); - } - // G. Giunta 2005/01/29: declare global these variables, // so that xmlrpc.inc will work even if included from within a function // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used. @@ -231,7 +208,7 @@ $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1'; $GLOBALS['xmlrpcName']='XML-RPC for PHP'; - $GLOBALS['xmlrpcVersion']='2.2.2'; + $GLOBALS['xmlrpcVersion']='3.0.0.beta'; // let user errors start at 800 $GLOBALS['xmlrpcerruser']=800; @@ -943,11 +920,7 @@ } // keepalives: enabled by default ONLY for PHP >= 4.3.8 - // (see http://curl.haxx.se/docs/faq.html#7.3) - if(version_compare(phpversion(), '4.3.8') >= 0) - { - $this->keepalive = true; - } + $this->keepalive = true; // by default the xml parser can support these 3 charset encodings $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');