Fix '0' being replaces by first string's value

Fixes #99
This commit is contained in:
Matthias Mullie 2016-03-01 08:46:47 +01:00
parent 3176239d15
commit 272e461134
2 changed files with 7 additions and 1 deletions

View File

@ -318,7 +318,7 @@ abstract class Minify
$minifier = $this;
$callback = function ($match) use ($minifier) {
// check the second index here, because the first always contains a quote
if (!$match[2]) {
if ($match[2] === '') {
/*
* Empty strings need no placeholder; they can't be confused for
* anything else anyway.

View File

@ -679,6 +679,12 @@ BUG
'if(!0){if(!0)console.log("test")}',
);
// https://github.com/matthiasmullie/minify/issues/99
$tests[] = array(
'"object";"object2";"0";"1"',
'"object";"object2";"0";"1"',
);
//update tests' expected results for cross-system compatibility
foreach ($tests as &$test) {
if (!empty($test[1])) {