summaryrefslogtreecommitdiff
path: root/debug.class
diff options
context:
space:
mode:
authorChristian Schneider2007-04-04 16:48:01 +0000
committerChristian Schneider2007-04-04 16:48:01 +0000
commit2099d5ec525e4806f91ec0b62be78692251b5d09 (patch)
treec2e78b5b0aabbe659fd0dbf36881258351f9e4dc /debug.class
parentfdeb982affccccf5002ff7b550e35261996d86b3 (diff)
downloaditools-2099d5ec525e4806f91ec0b62be78692251b5d09.tar.gz
itools-2099d5ec525e4806f91ec0b62be78692251b5d09.tar.bz2
itools-2099d5ec525e4806f91ec0b62be78692251b5d09.zip
Replace PHP 5 var_export object representation by old style (incomplete)
Diffstat (limited to 'debug.class')
-rw-r--r--debug.class10
1 files changed, 10 insertions, 0 deletions
diff --git a/debug.class b/debug.class
index e33a339..1be631b 100644
--- a/debug.class
+++ b/debug.class
@@ -141,6 +141,16 @@ function dump()
continue;
$item = gettype($arg) == 'resource' ? trim(print_r($arg, true)) : trim(var_export($arg, true));
+
+ # Replace PHP 5 var_export object representation by old style
+ while (preg_match("#(.*\b)(\w+)::__set_state\(array\(([^()]+)\)\)(.*)#s", $item, $regs))
+ {
+ list (, $head, $classname, $values, $tail) = $regs;
+ $classname = strtolower($classname);
+ $values = preg_replace("#'(\w+)' =>([^\n]+),#", 'var \$$1 = $2;', $values);
+ $item = $head . "class $classname { $values }$tail";
+ }
+
$item = preg_replace("#(=>?)\s*\n\s*(array|class)#", '$1 $2', $item); # array( and class on same line as key
$item = preg_replace('#array \(\s+([^({,;]+),\s+\)#', 'array( $1 )', $item); # 1-element arrays on 1 line
$item = preg_replace('#class (\S+) \{\s+([^({,;]+;)?\s+\}#', 'class $1 { $2 }', $item); # 1-element objects on 1 line