View Issue Details

IDProjectCategoryView StatusLast Update
0000443XdebugUncategorizedpublic2014-01-03 15:46
Reporterkminkler Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Target Version2.2dev 
Summary0000443: Segmentation Fault while calling undefined function during traversal of iterator
Description

Using xdebug 2.0.2, PHP 5.2.8 with no other extensions loaded.

Expected Behavior:

$ php -n test.php

Fatal error: Call to undefined function hasChildren() in /home/kminkler/test.php on line 31

Current Behavior:

$ php test.php
Segmentation fault

Running Program:

$ cat test.php
<?php

class A_Iterator implements RecursiveIterator
{
private $a = NULL;
private $a_children = NULL;
public function __construct(A $a) { $this->a = $a; $this->a_children = $a->getChildren(); }
// Iterator
public function rewind() { $this->a_children->rewind(); }
public function valid() { return $this->a_children->valid(); }
public function current() { return $this->a_children->current(); }
public function key() { return $this->a_children->key(); }
public function next() { $this->a_children->next(); }
// RecursiveIterator
public function hasChildren() { return $this->current()->hasChildren(); }
public function getChildren() { return new A_Iterator($this->current()); }
}

class A implements IteratorAggregate
{
private $b = array();
public function __construct(array $b) { $this->b = $b; }
// IteratorAggregate
public function getIterator() { return new A_Iterator($this); }

    // Non-Iterator methods
    public function hasChildren() { return count($this->b) > 0; }
    public function getChildren()
    {
            // segmentation fault on next line!
            if (!hasChildren())
            {
                    return new EmptyIterator();
            }

            return new ArrayIterator($this->b);
    }

}

$a = new A(array(new A(array()), new A(array())));

$iterator = new RecursiveIteratorIterator($a);
foreach ($a as $key => $value) { }

TagsNo tags attached.
Operating SystemVirtual Machine: CentOS Linux 2.6.9-42.0.8.ELsmp #1 SMP Tue Jan 30 12:33:47 EST 2007 i686 i686 i386 GNU/Linux
PHP Version5.2.8

Activities

derick

2009-07-05 20:49

administrator   ~0000975

I can reproduce this, but only with PHP 5.2 and not with PHP 5.3. can't quite figure out yet why this happens though.

derick

2014-01-03 15:46

administrator   ~0002655

This is still a problem with PHP 5.2, but as PHP 5.2 has been deprecated a long time ago, I am not going to spend time on this.

Issue History

Date Modified Username Field Change
2009-06-05 04:32 kminkler New Issue
2009-06-05 04:32 kminkler Operating System => Virtual Machine: CentOS Linux 2.6.9-42.0.8.ELsmp #1 SMP Tue Jan 30 12:33:47 EST 2007 i686 i686 i386 GNU/Linux
2009-06-05 04:32 kminkler PHP Version => 5.2.8
2009-06-05 04:32 kminkler Xdebug Version => 2.0.2
2009-07-05 20:49 derick Note Added: 0000975
2010-03-20 23:47 derick Target Version => 2.2dev
2014-01-03 15:46 derick Note Added: 0002655
2014-01-03 15:46 derick Status new => resolved
2014-01-03 15:46 derick Resolution open => won't fix
2014-01-03 15:46 derick Assigned To => derick
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized