Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003239 [Quercus] major always 01-12-09 12:10 01-15-09 17:00
Reporter haplo View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.2.1
Summary 0003239: Using custom ArrayIterator leeds to a StackOverflowError
Description This throws an StackOverflow :

class Iteratable implements IteratorAggregate {

    private $data = array();

    public function __construct(){
        $this->data['key1'] = 'value1';
        $this->data['key2'] = 'value2';
        $this->data['key3'] = 'value3';
        $this->data['key4'] = 'value4';
        $this->data['key5'] = 'value5';
    }

    public function getData(){
        return $this->data;
    }
    
    public function getIterator(){
        return new MyIterator($this);
    }
}

class MyIterator extends ArrayIterator{

    private $iteratable;

    public function __construct(Iteratable $iteratable){
        $this->iteratable = $iteratable;
        parent::__construct($iteratable->getData());
    }
}

$iteratable = new Iteratable();
foreach($iteratable as $key => $value){
    echo "$key => $value
\n";
}


Result on Apache:
key1 => value1
key2 => value2
key3 => value3
key4 => value4
key5 => value5

Quercus throws StackOverflowException

Greetings,
Peter
Additional Information
Attached Files

- Relationships

- Notes
(0003741)
ferg
01-15-09 17:00

php/4as5
 

- Issue History
Date Modified Username Field Change
01-12-09 12:10 haplo New Issue
01-12-09 12:12 haplo Issue Monitored: haplo
01-15-09 14:48 ferg Status new => assigned
01-15-09 14:48 ferg Assigned To  => ferg
01-15-09 17:00 ferg Note Added: 0003741
01-15-09 17:00 ferg Status assigned => closed
01-15-09 17:00 ferg Resolution open => fixed
01-15-09 17:00 ferg Fixed in Version  => 4.0.0


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker