summaryrefslogtreecommitdiff
path: root/it_debug.class
diff options
context:
space:
mode:
authorChristian Schneider2007-10-23 14:16:59 +0000
committerChristian Schneider2007-10-23 14:16:59 +0000
commit3f7ccc902a91aac2ff6ac2fe8947f07f989fbf03 (patch)
tree088ff5d66338588860c2c807847467e7f22f2cad /it_debug.class
parentd5c62dfa887a4ac72fdc9fdb60cbc9d9056f7125 (diff)
downloaditools-3f7ccc902a91aac2ff6ac2fe8947f07f989fbf03.tar.gz
itools-3f7ccc902a91aac2ff6ac2fe8947f07f989fbf03.tar.bz2
itools-3f7ccc902a91aac2ff6ac2fe8947f07f989fbf03.zip
Properly parse ED parameters using the PHP tokenizer to handle function calls
Diffstat (limited to 'it_debug.class')
-rw-r--r--it_debug.class29
1 files changed, 26 insertions, 3 deletions
diff --git a/it_debug.class b/it_debug.class
index 92753b2..bd81720 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -87,10 +87,33 @@ function dump($args)
$src = $GLOBALS['it_debug::dump source'][$file][$line-1];
- $paramlist = preg_match('/(D|ED|EDC|EDX)\s*\(\s*([^)]+)/i', $src, $parts) ? $parts[2] : "";
- $argnames = preg_split('/\s*,\s*/', $paramlist);
+ list($function, $paramlist) = it::match('\b(D|ED|EDC|EDX)\s*\((.*)', $src);
+ $paramtokens = token_get_all("<?php $paramlist");
+ array_shift($paramtokens);
+ $param = "";
+ foreach ($paramtokens as $token)
+ {
+ if ($token == "(")
+ $paramnesting++;
+ else if ($token == ")")
+ {
+ if (!$paramnesting--) # Found closing parens
+ {
+ $argnames[] = trim($param);
+ break;
+ }
+ }
+
+ if (($token == ",") && !$paramnesting)
+ {
+ $argnames[] = trim($param);
+ $param = "";
+ }
+ else
+ $param .= is_array($token) ? $token[1] : $token;
+ }
- if ($parts[1] == "EDC") # First argument was stripped by EDC
+ if (it::match('^EDC$', $function)) # First argument was removed by EDC
array_shift($argnames);
foreach ($args as $arg)