]> git.joonet.de Git - adminer.git/commitdiff
Save memory
authorJakub Vrana <jakub@vrana.cz>
Fri, 25 Mar 2011 12:36:12 +0000 (13:36 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 25 Mar 2011 12:36:12 +0000 (13:36 +0100)
adminer/include/functions.inc.php

index 8e71ef0675f7764b7d46341d3f98fa745ef83ca3..62daa2f5415a312f30c8f4b346e8ebcaf386ebfb 100644 (file)
@@ -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;