From a6dac0a9929061f3f484f8cdcc6e63d2d649fcad Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Fri, 9 Nov 2007 11:30:28 +0000 Subject: [PATCH] stripos() not present in PHP4, thanks to Sebastian --- libraries/import/sql.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/import/sql.php b/libraries/import/sql.php index 13fa84ddf..2cd2fec41 100644 --- a/libraries/import/sql.php +++ b/libraries/import/sql.php @@ -66,6 +66,11 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { } // Current length of our buffer $len = strlen($buffer); + // prepare an uppercase copy of buffer for PHP < 5 + // outside of the loop + if (PMA_PHP_INT_VERSION < 50000) { + $buffer_upper = strtoupper($buffer); + } // Grab some SQL queries out of it while ($i < $len) { $found_delimiter = false; @@ -109,7 +114,11 @@ while (!($finished && $i >= $len) && !$error && !$timeout_passed) { $p7 = $big_value; } // catch also "delimiter" - $p8 = stripos($buffer, 'DELIMITER', $i); + if (PMA_PHP_INT_VERSION >= 50000) { + $p8 = stripos($buffer, 'DELIMITER', $i); + } else { + $p8 = strpos($buffer_upper, 'DELIMITER', $i); + } if ($p8 === FALSE || $p8 >= ($len - 11) || $buffer[$p8 + 9] > ' ') { $p8 = $big_value; }