Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7922 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13131 invoked by uid 1010); 17 Feb 2004 13:15:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13107 invoked from network); 17 Feb 2004 13:15:52 -0000 Received: from unknown (HELO phoebe.host4u.net) (209.150.128.26) by pb1.pair.com with SMTP; 17 Feb 2004 13:15:52 -0000 Received: from ctdprimary (dsta-aa203.pivot.net [66.186.171.203]) by phoebe.host4u.net (8.11.6/8.11.6) with SMTP id i1HDFp319005 for ; Tue, 17 Feb 2004 07:15:51 -0600 Message-ID: <00b501c3f558$73f8d3c0$f7dea8c0@cyberware.local> To: Date: Tue, 17 Feb 2004 08:17:54 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00B2_01C3F52E.8AC36DB0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: segfault with iterators From: rrichards@ctindustries.net ("Rob Richards") ------=_NextPart_000_00B2_01C3F52E.8AC36DB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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. class Test implements Iterator { function c() { return new Test(); } /* No need to implement functionality - never gets here */ public function rewind() {} public function key() {} public function current() {} public function next() {} public function hasMore() {} } $obj =3D new Test(); /* foreach ($obj->c() as $value) { - works correctly with functions = implemented foreach ($obj->a as $value) { - correctly issues Invalid argument = supplied for foreach() */ foreach ($obj->c()->a as $value) { // Segafults print "Test\n"; } 0x08298238 in zend_pzval_unlock_func (z=3D0x5a5a5a5a) at /home/rrichards/php5/Zend/zend_execute.c:65 65 z->refcount--; (gdb) bt #0 0x08298238 in zend_pzval_unlock_func (z=3D0x5a5a5a5a) at /home/rrichards/php5/Zend/zend_execute.c:65 #1 0x082984dd in _get_zval_ptr_ptr (node=3D0x4047ea2c, Ts=3D0xbfffb860) at /home/rrichards/php5/Zend/zend_execute.c:142 #2 0x08295c59 in zend_fe_reset_handler (execute_data=3D0xbfffba90,=20 opline=3D0x4047ea14, op_array=3D0x4047e3c0) at /home/rrichards/php5/Zend/zend_execute.c:3630 #3 0x0828f7f4 in execute (op_array=3D0x4047e3c0) at /home/rrichards/php5/Zend/zend_execute.c:1339 #4 0x0826d4d1 in zend_execute_scripts (type=3D8, retval=3D0x0, = file_count=3D3) at /home/rrichards/php5/Zend/zend.c:1052 #5 0x0822a364 in php_execute_script (primary_file=3D0xbfffde90) at /home/rrichards/php5/main/main.c:1647 #6 0x0829c7ee in main (argc=3D2, argv=3D0xbfffdf24) at /home/rrichards/php5/sapi/cli/php_cli.c:941 #7 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6 Rob ------=_NextPart_000_00B2_01C3F52E.8AC36DB0--