Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7928 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58923 invoked by uid 1010); 17 Feb 2004 19:20:13 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 58879 invoked from network); 17 Feb 2004 19:20:13 -0000 Received: from unknown (HELO smtp2.netcologne.de) (194.8.194.218) by pb1.pair.com with SMTP; 17 Feb 2004 19:20:13 -0000 Received: from localhost.localdomain (xdsl-213-196-193-157.netcologne.de [213.196.193.157]) by smtp2.netcologne.de (Postfix) with SMTP id 9B2F039CB1 for ; Tue, 17 Feb 2004 20:20:07 +0100 (MET) Date: Tue, 17 Feb 2004 20:20:07 +0100 To: internals@lists.php.net Message-ID: <20040217202007.73e8a390@localhost.localdomain> In-Reply-To: <00b501c3f558$73f8d3c0$f7dea8c0@cyberware.local> References: <00b501c3f558$73f8d3c0$f7dea8c0@cyberware.local> Organization: Freelancer X-Mailer: Sylpheed version 0.9.8claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] segfault with iterators From: paj@pearfr.org (Pierre-Alain Joye) Hello, On Tue, 17 Feb 2004 08:17:54 -0500 "Rob Richards" wrote: > I ran into this with simplexml but am able to reproduce with userland > classes. > > The segfault only occurs when the property in question does not exist, > no __get and __set methods implemented (if either is implemented then > no segfault), and is not being called off the initial object in the > foreach. i.e. - $obj->valid()->invalid will segfault while > $obj->invalid doesnt. I got the same thing this morning and wondering why as well. I'm not sure it's due to the iterator but more to the (de)references. At some point ZE2 destroys the object (afair or see just before returning the object). Find below 2 scripts to reproduce the problem. In both the public property is not required. Only to show that is not related to the existence or non existence of a property. Works: ----- c(); foreach ($b->a as $value) { // Segafults print "Test\n"; } ?> Segfault: -------- c()->a as $value) { // Segafults print "Test\n"; } ?> Sidenote, if someone has some tips to get the ZE2 macros working in gdb (ie to work with all the the TSRMLS_C*, T, and other macros with explicit names ;) hth pierre