Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30088 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32666 invoked by uid 1010); 5 Jun 2007 21:19:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 32650 invoked from network); 5 Jun 2007 21:19:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2007 21:19:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=antony@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=antony@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: antony@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:32000] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/2C-33808-A53D5664 for ; Tue, 05 Jun 2007 17:19:24 -0400 Received: (qmail 19769 invoked from network); 5 Jun 2007 21:19:20 -0000 Received: from internal.zend.office (HELO ?127.0.0.1?) (10.1.1.1) by internal.zend.office with SMTP; 5 Jun 2007 21:19:20 -0000 Message-ID: <4665D357.5070509@zend.com> Date: Wed, 06 Jun 2007 01:19:19 +0400 User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: "mark@cyanox.nl" CC: internals@lists.php.net References: <4665D15F.2040501@cyanox.nl> In-Reply-To: <4665D15F.2040501@cyanox.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Recursive classes ... possible bug? From: antony@zend.com (Antony Dovgal) On 06.06.2007 01:10, mark@cyanox.nl wrote: > class class1{ > public $c2; > function __construct($c2){ > $this->c2 = $c2; > } > } > > class class2{ > public $c1; > function setC1($c1){ > $this->c1 = $c1; > } > function test(){ > echo $this == $this->c1->c2?'equals':'not equals'; // Somehow this > if statement triggers the error. > } > } > > > $tt = new class2(); > $t = new class1($tt); > $tt->setC1($t); > var_dump($t); > $tt->test(); > ?> > > I get the error: > > Fatal error: Nesting level too deep - recursive dependency? in > /home/cyanox/DEV/test_object_recursion.php on line 15 $t->$tt->$t->$tt->$t->$tt->$t->$tt->$t->$tt->$t and so on. So you get endless recursion when comparing the objects. > Although it is obvious that there is a recursion I think this simple > example should work without error. Sure, if you have any proposals/ideas - feel free to share them. -- Wbr, Antony Dovgal