From: Operating system: Linux 2.6.18-194.26.1.el5 PHP version: 5.4.0RC1 Package: Reproducible crash Bug Type: Bug Bug description:Stack overflow makes PHP crash with Segmentation Fault
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". -- Edit bug report at https://bugs.php.net/bug.php?id=60266&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60266&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60266&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60266&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60266&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60266&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60266&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60266&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60266&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60266&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60266&r=support Expected behavior: https://bugs.php.net/fix.php?id=60266&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60266&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60266&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60266&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60266&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60266&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60266&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60266&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60266&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60266&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60266&r=mysqlcfg