Edit report at https://bugs.php.net/bug.php?id=62629&edit=1
ID: 62629 Updated by: larue...@php.net Reported by: zoeslam at gmail dot com Summary: IteratorIterator doesn't delegate count() method -Status: Assigned +Status: Closed Type: Bug Package: SPL related Operating System: Ubuntu 12.04 PHP Version: 5.4.5 Assigned To: colder Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2012-07-21 09:05:09] larue...@php.net yeah, the reason should be the same. ------------------------------------------------------------------------ [2012-07-21 08:29:44] zoeslam at gmail dot com Description: ------------ This bug report MAY be similar to: https://bugs.php.net/bug.php?id=62616 But behave differently Test script: --------------- class MyFile extends SplFileObject { private $x = 10; private $y = 20; public function setX($x) { $this->x = $x; } public function setY($y) { $this->y = $y; } public function getX() { return $this->x; } public function count() { return $this->y; } } $myFile = new MyFile(__FILE__); var_dump($myFile->getX()); var_dump($myFile->count()); $myFile->setX(15); $myFile->setY(25); var_dump($myFile->getX()); var_dump($myFile->count()); $ii = new IteratorIterator($myFile); var_dump($ii->getX()); var_dump($ii->count()); Expected result: ---------------- int(10) int(20) int(15) int(25) int(15) int(25) Actual result: -------------- int(10) int(20) int(15) int(25) int(15) Notice: Undefined property: IteratorIterator::$y in /tmp/it.php on line 12 NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62629&edit=1