cvs: php4 /pear PEAR.php /pear/DB odbc.php /pear/XML Parser.php /pear/tests pear_versioncmp.phpt
| From: | Stig Bakken | Date: | Thu, 11 Oct 2001 22:11:35 +0000 |
| Subject: | cvs: php4 /pear PEAR.php /pear/DB odbc.php /pear/XML Parser.php /pear/tests pear_versioncmp.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-980@lists.php.net to get a copy of this message | ||
ssb Thu Oct 11 18:11:35 2001 EDT
Removed files:
/php4/pear/tests pear_versioncmp.phpt
Modified files:
/php4/pear PEAR.php
/php4/pear/DB odbc.php
/php4/pear/XML Parser.php
Log:
* replaced PEAR::phpVersionIs with version_compare
Index: php4/pear/PEAR.php
diff -u php4/pear/PEAR.php:1.23 php4/pear/PEAR.php:1.24
--- php4/pear/PEAR.php:1.23 Fri Oct 5 08:46:21 2001
+++ php4/pear/PEAR.php Thu Oct 11 18:11:34 2001
@@ -19,7 +19,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: PEAR.php,v 1.23 2001/10/05 12:46:21 cox Exp $
+// $Id: PEAR.php,v 1.24 2001/10/11 22:11:34 ssb Exp $
//
define('PEAR_ERROR_RETURN', 1);
@@ -491,63 +491,6 @@
}
// }}}
-
- /**
- * Converts a php version string to an array
- * (supported formats are: X.X.X, X.X.X-dev, X.X.XplX)
- *
- * @param string $version A valid php version (ie. 4.0.7)
- * @return array
- * @see PEAR::phpVersionIs()
- */
- function _explodePHPVersion($version)
- {
- @list($version, ) = explode('-', $version); // 4.0.7-dev
- @list($version, ) = explode('RC', $version); // 4.0.7RC1
- list($mayor, $minor, $sub) = explode('.', $version);
- @list($sub, $patch) = explode('pl', $sub); // 4.0.14pl1
- if ($patch === null) {
- $patch = 0;
- }
- return array($mayor, $minor, $sub, $patch);
- }
-
- /**
- * Find if a version is minor or greater than a given PHP version
- * (it should be red as "if my php version is minor|greater|between this one)
- *
- * Usage:
- * PEAR::phpVersionIs('4.0.7') => if the current version
- * is minor than version 4.0.7
- * PEAR::phpVersionIs(null, '4.0.12pl3') => if current is greater that 4.0.12pl3
- * PEAR::phpVersionIs('4.0.9', '4.0.4') => if current is between 4.0.9
and 4.0.4
- *
- * @param string $minorthan Version should be minor than this param
- * @param string $greaterthan Version should be greater than this param
- * @param string $version Version to compare with (defaults to current)
- *
- * @return bool If the comparation was successful or not
- */
- function phpVersionIs($minorthan = null, $greaterthan = null, $version = PHP_VERSION)
- {
- $version = PEAR::_explodePHPVersion($version);
- $ret = false;
- if ($minorthan) {
- $minor = PEAR::_explodePHPVersion($minorthan);
- for ($i=0; $i < count($version)-1 && $minor[$i] == $version[$i]; $i++);
- if ($version[$i] >= $minor[$i]) {
- return false;
- }
- $ret = true;
- }
- if ($greaterthan) {
- $greater = PEAR::_explodePHPVersion($greaterthan);
- for ($i=0; $i < count($version)-1 && $greater[$i] == $version[$i]; $i++);
- $ret = ($version[$i] > $greater[$i]) ? true : false;
- }
- return $ret;
- }
-
}
// {{{ _PEAR_call_destructors()
Index: php4/pear/DB/odbc.php
diff -u php4/pear/DB/odbc.php:1.40 php4/pear/DB/odbc.php:1.41
--- php4/pear/DB/odbc.php:1.40 Fri Oct 5 10:18:17 2001
+++ php4/pear/DB/odbc.php Thu Oct 11 18:11:34 2001
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: odbc.php,v 1.40 2001/10/05 14:18:17 cox Exp $
+// $Id: odbc.php,v 1.41 2001/10/11 22:11:34 ssb Exp $
//
// Database independent query interface definition for PHP's ODBC
// extension.
@@ -191,13 +191,13 @@
function fetchInto($result, &$row, $fetchmode, $rownum=null)
{
if ($rownum !== null) {
- if (PEAR::phpVersionIs('4.0.5')) {
+ if (version_compare(phpversion(), "4.0.5", "lt")) {
$cols = odbc_fetch_into($result, $rownum, &$row);
} else {
$cols = odbc_fetch_into($result, $rownum, $row);
}
} else {
- if (PEAR::phpVersionIs('4.0.5')) {
+ if (version_compare(phpversion(), "4.0.5", "lt")) {
$cols = odbc_fetch_into($result, &$row);
} else {
$cols = odbc_fetch_into($result, $row);
Index: php4/pear/XML/Parser.php
diff -u php4/pear/XML/Parser.php:1.18 php4/pear/XML/Parser.php:1.19
--- php4/pear/XML/Parser.php:1.18 Fri Oct 5 13:47:07 2001
+++ php4/pear/XML/Parser.php Thu Oct 11 18:11:34 2001
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Parser.php,v 1.18 2001/10/05 17:47:07 cox Exp $
+// $Id: Parser.php,v 1.19 2001/10/11 22:11:34 ssb Exp $
require_once "PEAR.php";
@@ -145,7 +145,7 @@
case "func":
// use call_user_func() when php >= 4.0.7
// or call_user_method() if not
- if (PEAR::phpVersionIs('4.0.7')) {
+ if (version_compare(phpversion(), '4.0.7', 'lt')) {
$this->use_call_user_func = false;
} else {
$this->use_call_user_func = true;