- temoved compat stuff and checks from trunk after having created the php4 branch;
authorggiunta <ggiunta@013ecfd8-0664-425d-a759-9c98391dc3f9>
Wed, 6 May 2009 11:40:50 +0000 (11:40 +0000)
committerggiunta <ggiunta@013ecfd8-0664-425d-a759-9c98391dc3f9>
Wed, 6 May 2009 11:40:50 +0000 (11:40 +0000)
- 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

ChangeLog
lib/compat/array_key_exists.php [deleted file]
lib/compat/is_a.php [deleted file]
lib/compat/is_callable.php [deleted file]
lib/compat/is_scalar.php [deleted file]
lib/compat/var_export.php [deleted file]
lib/compat/version_compare.php [deleted file]
lib/xmlrpc.inc

index 6b241cf..3f8ca49 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,17 @@
+2009-04-06 - G. Giunta (giunta.gaetano@gmail.com)\r
+\r
+       * create php4 branch, rename trunk to 3.0.0beta - it will be the php5-only version\r
+\r
+       * xmlrpc.inc: removed test fpr php version and inclusion of compat patches for really\r
+       really old versions of php 4\r
+\r
 2009-03-16 - G. Giunta (giunta.gaetano@gmail.com) thanks Tommaso Trani\r
 \r
        * move from CVS to SVN on sf.net; file layout now is the same as in packaged lib\r
 \r
        * xmlrpc.inc: fix php warning when receiving 'false' in a bool value\r
 \r
-    * Makefile, doc/Makefile: alter to follow new file layout\r
+       * Makefile, doc/Makefile: alter to follow new file layout\r
 \r
        * tagged and released as 2.2.2\r
 \r
diff --git a/lib/compat/array_key_exists.php b/lib/compat/array_key_exists.php
deleted file mode 100644 (file)
index 4ee07fd..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 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/3_0.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: Aidan Lister <aidan@php.net>                                |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-/**
- * Replace array_key_exists()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.array_key_exists
- * @author      Aidan Lister <aidan@php.net>
- * @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 (file)
index 0d52226..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 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/3_0.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: Aidan Lister <aidan@php.net>                                |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-/**
- * Replace function is_a()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.is_a
- * @author      Aidan Lister <aidan@php.net>
- * @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 (file)
index fccc19d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Replace function is_callable()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.is_callable
- * @author      Gaetano Giunta <giunta.gaetano@sea-aeroportimilano.it>
- * @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 (file)
index aa13682..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 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/3_0.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.               |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-/**
- * Replace is_scalar()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.is_scalar
- * @author      Gaetano Giunta
- * @version     $Revision: 1.2 $
- * @since       PHP 4.0.5
- * @require     PHP 4 (is_bool)
- */
-if (!function_exists('is_scalar')) {
-    function is_scalar($val)
-    {
-        // Check input
-        return (is_bool($val) || is_int($val) || is_float($val) || is_string($val));
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/lib/compat/var_export.php b/lib/compat/var_export.php
deleted file mode 100644 (file)
index 947210f..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 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/3_0.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: Aidan Lister <aidan@php.net>                                |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-/**
- * Replace var_export()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.var_export
- * @author      Aidan Lister <aidan@php.net>
- * @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 (file)
index 01fc3cf..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 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/3_0.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: Philippe Jausions <Philippe.Jausions@11abacus.com>          |
-// |          Aidan Lister <aidan@php.net>                                |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-
-/**
- * Replace version_compare()
- *
- * @category    PHP
- * @package     PHP_Compat
- * @link        http://php.net/function.version_compare
- * @author      Philippe Jausions <Philippe.Jausions@11abacus.com>
- * @author      Aidan Lister <aidan@php.net>
- * @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
index 6bad30a..f57051a 100644 (file)
                }\r
        }\r
 \r
-       // Try to be backward compat with php < 4.2 (are we not being nice ?)\r
-       $phpversion = phpversion();\r
-       if($phpversion[0] == '4' && $phpversion[2] < 2)\r
-       {\r
-               // give an opportunity to user to specify where to include other files from\r
-               if(!defined('PHP_XMLRPC_COMPAT_DIR'))\r
-               {\r
-                       define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/');\r
-               }\r
-               if($phpversion[2] == '0')\r
-               {\r
-                       if($phpversion[4] < 6)\r
-                       {\r
-                               include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php');\r
-                       }\r
-                       include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php');\r
-                       include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php');\r
-                       include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php');\r
-               }\r
-               include(PHP_XMLRPC_COMPAT_DIR.'var_export.php');\r
-               include(PHP_XMLRPC_COMPAT_DIR.'is_a.php');\r
-       }\r
-\r
        // G. Giunta 2005/01/29: declare global these variables,\r
        // so that xmlrpc.inc will work even if included from within a function\r
        // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.\r
        $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1';\r
 \r
        $GLOBALS['xmlrpcName']='XML-RPC for PHP';\r
-       $GLOBALS['xmlrpcVersion']='2.2.2';\r
+       $GLOBALS['xmlrpcVersion']='3.0.0.beta';\r
 \r
        // let user errors start at 800\r
        $GLOBALS['xmlrpcerruser']=800;\r
                        }\r
 \r
                        // keepalives: enabled by default ONLY for PHP >= 4.3.8\r
-                       // (see http://curl.haxx.se/docs/faq.html#7.3)\r
-                       if(version_compare(phpversion(), '4.3.8') >= 0)\r
-                       {\r
-                               $this->keepalive = true;\r
-                       }\r
+                       $this->keepalive = true;\r
 \r
                        // by default the xml parser can support these 3 charset encodings\r
                        $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII');\r