Solution for “Fatal error: Maximum function nesting level of '100' reached, aborting!” in PHP

后端 未结 22 2380
我寻月下人不归
我寻月下人不归 2020-11-22 16:45

I have made a function that finds all the URLs within an html file and repeats the same process for each html content linked to the discovered URLs. The function is recursiv

22条回答
  •  执笔经年
    2020-11-22 17:07

    You can also modify the {debug} function in modifier.debug_print_var.php, in order to limit its recursion into objects.

    Around line 45, before :

    $results .= '
    ' . str_repeat(' ', $depth * 2) . ' ->' . strtr($curr_key, $_replace) . ' = ' . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);

    After :

    $max_depth = 10;
    $results .= '
    ' . str_repeat(' ', $depth * 2) . ' ->' . strtr($curr_key, $_replace) . ' = ' . ($depth > $max_depth ? 'Max recursion depth:'.(++$depth) : smarty_modifier_debug_print_var($curr_val, ++$depth, $length));

    This way, Xdebug will still behave normally: limit recursion depth in var_dump and so on. As this is a smarty problem, not a Xdebug one!

提交回复
热议问题