Hello,

On Tue, 17 Feb 2004 08:17:54 -0500
"Rob Richards" <[EMAIL PROTECTED]> 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:
-----
<?php
class Test {
   public $a = array(1,2,3,4,5); // if removed, the notice works
   function c() {
      return new Test();
   }

}
$obj = new Test();
$b = $obj->c();
foreach ($b->a as $value) { // Segafults
    print "Test\n";
}

?>

Segfault:
--------
<?php
class Test {
   public $a = array(1,2,3,4,5); // removed, crash too
   function c() {
      return new Test();
   }

}
$obj = new Test();
foreach ($obj->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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to