From ea58d9f259f3aa19896ee527264fdbe7615e3ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 28 Nov 2005 18:21:19 +0000 Subject: [PATCH] Do not use functions not supported by older PHP. --- ChangeLog | 2 ++ libraries/sqlparser.lib.php | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index bdcfbac60..bc1ede73f 100755 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ $Source$ functions. * libraries/auth/cookie.auth.lib.php: Display PMA_errors on login form. * Documentation.html: Add anchors to configuration directives. + * libraries/sqlparser.lib.php: Do not use functions not supported by older + PHP. 2005-11-28 Sebastian Mendel * libraries/Theme.class.php, libraries/Theme_Manager.class.php: diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 257ede81d..04855297b 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -389,16 +389,18 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) { $is_float_digit = $c == '.'; $is_float_digit_exponent = FALSE; - // Nijel: Fast skip is especially needed for huge BLOB data: - if ($is_hex_digit) { - $count2++; - $pos = strspn($sql, '0123456789abcdefABCDEF', $count2); - if ($pos > $count2) $count2 = $pos; - unset($pos); - } elseif ($is_digit) { - $pos = strspn($sql, '0123456789', $count2); - if ($pos > $count2) $count2 = $pos; - unset($pos); + // Nijel: Fast skip is especially needed for huge BLOB data, requires PHP at least 4.3.0: + if (PMA_PHP_INT_VERSION >= 40300) { + if ($is_hex_digit) { + $count2++; + $pos = strspn($sql, '0123456789abcdefABCDEF', $count2); + if ($pos > $count2) $count2 = $pos; + unset($pos); + } elseif ($is_digit) { + $pos = strspn($sql, '0123456789', $count2); + if ($pos > $count2) $count2 = $pos; + unset($pos); + } } while (($count2 < $len) && PMA_STR_isSqlIdentifier(PMA_substr($sql, $count2, 1), ($is_sql_variable || $is_digit))) {