|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-11-06 20:27 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Description: ------------ When running a recursive loop with lots of iterations, PHP will segfault. This will usually be a problem when you write buggy code by accident, but I guess it is possible to imagine sane programs which uses lots of recursive calls. In any case, it is somewhat hard to debug the crash when it happens, because you do not get an error message when running it in a browser. Reproduce code: --------------- <?php $i=0; function f() { global $i; printf("%d\n", $i++); f(); } f(); ?> Expected result: ---------------- (Ignoring the fact that the posted function is tail recursive, and therefore could be rewritten as a non-recursive loop) PHP should emit an E_ERROR before it runs out of space. Preferably also an E_RECOVERABLE_ERROR or E_WARNING a little before it really runs out of space. Actual result: -------------- $ php test.php 1 2 3 [...] 29066 29067 zsh: segmentation fault php test.php