diff --git a/compile.php b/compile.php index 45b36021..c2615632 100755 --- a/compile.php +++ b/compile.php @@ -350,7 +350,6 @@ $file = preg_replace('~\.\./adminer/static/(default\.css|favicon\.ico)~', '\n?|\\?>\n?<\\?php~", '', $file); $file = php_shrink($file); $filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php"; diff --git a/php_shrink.inc.php b/php_shrink.inc.php index f127493d..fe3b1c18 100644 --- a/php_shrink.inc.php +++ b/php_shrink.inc.php @@ -13,6 +13,7 @@ */ function php_shrink($input) { // based on http://latrine.dgx.cz/jak-zredukovat-php-skripty + $input = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $input); $special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER', '$http_response_header', '$php_errormsg')); $short_variables = array(); $shortening = true; diff --git a/tests/php_shrink.php b/tests/php_shrink.php index 38faff32..95292b44 100644 --- a/tests/php_shrink.php +++ b/tests/php_shrink.php @@ -33,3 +33,4 @@ check('$ab = 1; echo "$ab";', '$a=1;echo"$a";'); check('echo 1; echo 3;', 'echo 1,3;'); check('echo 1; ?>2