#46112 [Opn->Fbk]: Segfault when throwing exception during class construction
| From: | scottmac@php.net | Date: | Thu, 18 Sep 2008 14:26:03 +0000 |
| Subject: | #46112 [Opn->Fbk]: Segfault when throwing exception during class construction | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-129084@lists.php.net to get a copy of this message | ||
ID: 46112
Updated by: scottmac@php.net
Reported By: erikg at codepoet dot no
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: ArchLinux
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
I can't reproduce this.
PHP Fatal error: Uncaught exception 'Exception' with message 'error'
in /tmp/test.php:3
Stack trace:
#0 /tmp/test.php(8): error()
#1 /tmp/test.php(17): Foo->__construct()
#2 {main}
thrown in /tmp/test.php on line 3
Previous Comments:
------------------------------------------------------------------------
[2008-09-18 10:07:16] erikg at codepoet dot no
Oops, the $item variables weren't supposed to be there. Doesn't matter
though, the segfault still triggers.
------------------------------------------------------------------------
[2008-09-18 10:04:08] erikg at codepoet dot no
Description:
------------
Apache segfaults when throwing an exception in a function whose return
value is used to construct a class within another class' constructor.
That sentence made my head hurt, just read the code :) I haven't been
able to remove any code while still reproducing the crash.
Reproduce code:
---------------
function error($item) {
throw new Exception("error");
}
class Foo {
function __construct() {
new Bar(error($item));
}
}
class Bar {
function __construct($param) {
}
}
new Foo();
Expected result:
----------------
Foo object to be instantiated
Actual result:
--------------
Apache segfaults
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46112&edit=1