Changeset 80f0bd3 in git


Ignore:
Timestamp:
2011-04-17T03:03:10Z (9 years ago)
Author:
Xuefer <xuefer@…>
Branches:
3.0, 3.1, 3.2, master, trunk
Children:
489be67
Parents:
cccdfd6
Message:

decompiler: dirty improvement for \r\n

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@750 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Decompiler.class.php

    rcccdfd6 r80f0bd3  
    108108    function toCode($indent)
    109109    {
    110         return var_export($this->value, true);
     110        $code = var_export($this->value, true);
     111        if (gettype($this->value) == 'string') {
     112            switch ($this->value) {
     113            case "\r":
     114                return '"\\r"';
     115            case "\n":
     116                return '"\\n"';
     117            case "\r\n":
     118                return '"\\r\\n"';
     119            }
     120            $code = str_replace("\r\n", '\' . "\\r\\n" . \'', $code);
     121            $code = str_replace("\r", '\' . "\\r" . \'', $code);
     122            $code = str_replace("\n", '\' . "\\n" . \'', $code);
     123        }
     124        return $code;
    111125    }
    112126}
  • decompilesample.php

    rcccdfd6 r80f0bd3  
    149149}
    150150
     151echo "\r\n";
     152echo "\r";
     153echo "\n";
    151154echo str_replace(array('a' => 'a', 'b' => 'c'), 'b');
    152155$object = new ClassName();
Note: See TracChangeset for help on using the changeset viewer.