Browse Source

decompiler: dirty improvement for \r\n

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@750 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent
commit
80f0bd32d7
  1. 16
      Decompiler.class.php
  2. 3
      decompilesample.php

16
Decompiler.class.php

@ -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;
}
}
// }}}

3
decompilesample.php

@ -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();

Loading…
Cancel
Save