Bug #60266 [Opn->Bgs]: Stack overflow makes PHP crash with Segmentation Fault
| From: | johannes@php.net | Date: | Fri, 11 Nov 2011 14:52:57 +0000 |
| Subject: | Bug #60266 [Opn->Bgs]: Stack overflow makes PHP crash with Segmentation Fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165050@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60266&edit=1
ID: 60266
Updated by: johannes@php.net
Reported by: smh at wannafind dot dk
Summary: Stack overflow makes PHP crash with Segmentation
Fault
-Status: Open
+Status: Bogus
Type: Bug
Package: Reproducible crash
Operating System: Linux 2.6.18-194.26.1.el5
PHP Version: 5.4.0RC1
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You're having an infinite recursion. This recursion leads to an stack overflow. This causes the
operating system to terminate the process. Nothing PHP can fix.
Previous Comments:
------------------------------------------------------------------------
[2011-11-11 13:14:34] smh at wannafind dot dk
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 this bug report at https://bugs.php.net/bug.php?id=60266&edit=1