|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-11 14:52 UTC] johannes@php.net
[2011-11-11 14:52 UTC] johannes@php.net
-Status: Open
+Status: Bogus
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Description: ------------ Whenever a PHP script encounters a stack overflow, it just dies with a message to stderr stating: "Segmentation fault". Test script: --------------- #!/usr/local/bin/php <?php function segmentationFaultFunction() { static $counter; echo ++$counter . ' '; $func = function(){ return segmentationFaultFunction(); }; $func->__invoke(); return $func; } $function = segmentationFaultFunction(); $function->__invoke(); echo 'Done, no segmentation faults' . PHP_EOL; Expected result: ---------------- I expected my error handler to be called with a stack trace. The best solution would be if PHP registers the error before crashing and throws an exception with the stack trace. The second best solution would be if PHP could give us a better error description than Segmentation fault. Maybe just terminate the script with an error that looks like this: "Stack overflow in file: /scripts/test.segfault.php on line 10". Actual result: -------------- Script terminates with an uncatchable error to stdout: "Segmentation fault".