1
0
Fork 0

decompiler: dirty improvement for \r\n

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@750 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 2011-04-17 03:03:10 +00:00
parent cccdfd61aa
commit 80f0bd32d7
2 changed files with 18 additions and 1 deletions

View File

@ -107,7 +107,21 @@ class Decompiler_Value extends Decompiler_Object // {{{
function toCode($indent)
{
return var_export($this->value, true);
$code = var_export($this->value, true);
if (gettype($this->value) == 'string') {
switch ($this->value) {
case "\r":
return '"\\r"';
case "\n":
return '"\\n"';
case "\r\n":
return '"\\r\\n"';
}
$code = str_replace("\r\n", '\' . "\\r\\n" . \'', $code);
$code = str_replace("\r", '\' . "\\r" . \'', $code);
$code = str_replace("\n", '\' . "\\n" . \'', $code);
}
return $code;
}
}
// }}}

View File

@ -148,6 +148,9 @@ final class Child extends ClassName implements IInterface
}
}
echo "\r\n";
echo "\r";
echo "\n";
echo str_replace(array('a' => 'a', 'b' => 'c'), 'b');
$object = new ClassName();
$object = new $className();