#37976 [Com]: Recursive object creation causes segfault
| From: | judas dot iscariote at gmail dot com | Date: | Fri, 30 Jun 2006 21:50:04 +0000 |
| Subject: | #37976 [Com]: Recursive object creation causes segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99009@lists.php.net to get a copy of this message | ||
ID: 37976
Comment by: judas dot iscariote at gmail dot com
Reported By: e at osterman dot com
Status: Open
Bug Type: Class/Object related
Operating System: Redhat
PHP Version: 5.1.4
New Comment:
this is the expected behaviuor, if you want recursion control to aid
development or something, install xdebug.
Previous Comments:
------------------------------------------------------------------------
[2006-06-30 18:54:58] e at osterman dot com
Description:
------------
Sorry if this is a duplicate bug; the words __construct and segfault
appear thousands of times in this bug database.
If you try to construct an object of yourself in the constructor, the
infinite recursion causes a segfault. Ofcourse, you never want to
construct yourself like this, but then again, you never want to
segfault either.
Reproduce code:
---------------
<?
/*
* Tested on:
* PHP 5.1.4 (cli) (built: May 18 2006 09:50:08)
* Copyright (c) 1997-2006 The PHP Group
* Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
*/
class SegFault
{
public function __construct()
{
new SegFault();
}
}
$breakme = new SegFault();
?>
Expected result:
----------------
PHP Warning: something to the effect of infinite recursion
Actual result:
--------------
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37976&edit=1