summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2016-07-13 17:27:45 +0200
committerUrban Müller2016-07-13 17:27:45 +0200
commit1f7cbb5a8a7869073d96c0f2dae45be7c0eed0c2 (patch)
tree336f2100e96a9edc16c8f554f0caea065e0ff9be
parent1af4c9e9c53cb9e76f4b8597ea28163c5f035c26 (diff)
downloaditools-1f7cbb5a8a7869073d96c0f2dae45be7c0eed0c2.tar.gz
itools-1f7cbb5a8a7869073d96c0f2dae45be7c0eed0c2.tar.bz2
itools-1f7cbb5a8a7869073d96c0f2dae45be7c0eed0c2.zip
prevent infinite recursions when using ED() in it::replace or ::match
-rw-r--r--it_debug.class8
1 files changed, 4 insertions, 4 deletions
diff --git a/it_debug.class b/it_debug.class
index b0b1598..2c08e4b 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -83,7 +83,7 @@ static function dump($args)
list($blue, $noblue, $red, $nored, $ansiok) = getenv('IT_ED_BRIGHT') ? array("\033[34m", "\033[m", "\033[33m", "\033[m", 1) : array("\033[34m", "\033[m", "\033[31m", "\033[m", 1);
$src = it_debug::srcline(1);
- list($function, $paramlist) = it::match('\b(D|ED|EDC|EDX)\s*\((.*)', $src);
+ list($dummy, $function, $paramlist) = preg_match('#\b(D|ED|EDC|EDX)\s*\((.*)#i', $src, $parts) ? $parts : array();
$paramtokens = token_get_all("<?php $paramlist");
array_shift($paramtokens);
$param = "";
@@ -110,7 +110,7 @@ static function dump($args)
$param .= is_array($token) ? $token[1] : $token;
}
- if (it::match('^EDC$', $function)) # First argument was removed by EDC
+ if (preg_match('#^EDC$#i', $function)) # First argument was removed by EDC
array_shift($argnames);
foreach ($args as $arg)
@@ -129,7 +129,7 @@ static function dump($args)
$item = preg_replace_callback('/\b(1[234]\d\d\d\d\d\d\d\d)\b(.*)/', function($m) { return $m[1] . $m[2] . " # " . date('Y-m-d H:i:s', $m[1]); }, $item);
$item = preg_replace("#(=>?)\s*\n\s*(array|class)#", '$1 $2', $item); # array( and class on same line as key
- $item = preg_replace_callback('#array \(\s+([^(){};]{1,100}),\s+\)#', function($m) { return "array (" . it::replace(array("\n\s*" => " "), $m[1]) . ")"; }, $item); # short arrays on 1 line
+ $item = preg_replace_callback('#array \(\s+([^(){};]{1,100}),\s+\)#', function($m) { return "array (" . preg_replace("#\n\s*#", " ", $m[1]) . ")"; }, $item); # short arrays on 1 line
$item = preg_replace('#class (\S+) \{\s+([^({,;]+;)?\s+\}#', 'class $1 { $2 }', $item); # 1-element objects on 1 line
#$item = preg_replace('#\{\s*var \$attr#', '{ var $attr', $item); # move $attr on same line
$item = preg_replace("#\\(\s*\n\s*\\)#", "()", $item); # empty arrays on 1 line
@@ -157,7 +157,7 @@ static function dump($args)
if ($htmlok)
return "<pre title='$title' style='color:#c00; text-align:left; background:white; border-bottom:1px solid #ddd; z-index:9999; position:relative'>$r</pre>\n";
else
- return $ansiok ? "$r\n" : "\xe2\x96\x88\xe2\x96\x8c" . it::replace(array("\n" => "\n\xe2\x96\x88 "), "$r") . "\n";
+ return $ansiok ? "$r\n" : "\xe2\x96\x88\xe2\x96\x8c" . preg_replace("#\n#", "\n\xe2\x96\x88 ", "$r") . "\n";
}
/**