Skip to content
Permalink
Browse files

Trace: Avoid stack exhaustion.

Callables can be arrays, too. Delegate the rendering of callback function names as trace strings to callback_tostring().
  • Loading branch information...
rwetzlmayr committed Mar 4, 2016
1 parent b411008 commit 5e1d3769efe89d3129587b6e7ff164507e12f449
Showing with 1 addition and 6 deletions.
  1. +1 −6 textpattern/lib/txplib_misc.php
@@ -1888,12 +1888,7 @@ function callback_event($event, $step = '', $pre = 0)
foreach ($plugin_callback as $c) {
if ($c['event'] == $event && (empty($c['step']) || $c['step'] == $step) && $c['pre'] == $pre) {
if (is_callable($c['function'])) {
if (is_string($c['function'])) {
$trace->start("\t[Call function: '{$c['function']}'".(empty($argv) ? '' : ", argv='".serialize($argv)."'") . "]");
} elseif (@is_object($c['function'][0])) {
$objname = @get_class($c['function'][0]);
$trace->start("\t[Call object: '{$objname}']");
}
$trace->start("\t[Call function: '".callback_tostring($c['function'])."'".(empty($argv) ? '' : ", argv='".serialize($argv)."'")."]");
$return_value = call_user_func_array($c['function'], array('event' => $event, 'step' => $step) + $argv);

0 comments on commit 5e1d376

Please sign in to comment.
You can’t perform that action at this time.