Browse Source

Decompiler: remove '' . and . '' for string constant

master
Xuefer 5 years ago
parent
commit
828ca4e4c5
1 changed files with 7 additions and 11 deletions
  1. +7
    -11
      lib/Decompiler.class.php

+ 7
- 11
lib/Decompiler.class.php View File

@ -222,20 +222,16 @@ class Decompiler_Value extends Decompiler_Object // {{{
{
$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);
$code = preg_replace_callback("![\r\n]+!", array(&$this, 'convertNewline'), $code);
$code = preg_replace("!^'' \\. \"|\" \\. ''\$!", '"', $code);
}
return $code;
}
function convertNewline($m)
{
return "' . \"". strtr($m[0], array("\r" => "\\r", "\n" => "\\n")) . "\" . '";
}
}
// }}}
class Decompiler_Code extends Decompiler_Object // {{{


Loading…
Cancel
Save