#37976 [Opn->Bgs]: Recursive object creation causes segfault

From: Date: Fri, 30 Jun 2006 22:08:23 +0000
Subject: #37976 [Opn->Bgs]: Recursive object creation causes segfault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99013@lists.php.net to get a copy of this message
ID: 37976 Updated by: tony2001@php.net Reported By: e at osterman dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Redhat PHP Version: 5.1.4 New Comment: Yes, endless recursion is likely to eat all the RAM and/or cause a crash. That was already reported thousands of times. Previous Comments: ------------------------------------------------------------------------ [2006-06-30 21:50:04] judas dot iscariote at gmail dot com this is the expected behaviuor, if you want recursion control to aid development or something, install xdebug. ------------------------------------------------------------------------ [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

« previous php.bugs (#99013) next »