From b5cbbce3cd71f4e78468599c9b6892fa47bb8779 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 25 Mar 2011 13:36:12 +0100 Subject: [PATCH] Save memory --- adminer/include/functions.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 8e71ef06..62daa2f5 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -496,10 +496,11 @@ function get_file($key, $decompress = false) { : $file["tmp_name"] )); //! may not be reachable because of open_basedir if ($decompress) { - if (function_exists("iconv") && ereg("^\xFE\xFF|^\xFF\xFE", $return, $regs)) { + $start = substr($return, 0, 3); + if (function_exists("iconv") && ereg("^\xFE\xFF|^\xFF\xFE", $start, $regs)) { // not ternary operator to save memory $return = iconv("utf-16", "utf-8", $return); - } else { // not ternary operator to save memory - $return = ereg_replace("^\xEF\xBB\xBF", "", $return); // UTF-8 BOM + } elseif ($start == "\xEF\xBB\xBF") { // UTF-8 BOM + $return = substr($return, 3); } } return $return;