Bug #62629 [Csd]: IteratorIterator doesn't delegate count() method
| From: | laruence@php.net | Date: | Sat, 21 Jul 2012 14:46:21 +0000 |
| Subject: | Bug #62629 [Csd]: IteratorIterator doesn't delegate count() method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172143@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62629&edit=1
ID: 62629
Updated by: laruence@php.net
Reported by: zoeslam at gmail dot com
Summary: IteratorIterator doesn't delegate count() method
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:
refer to the commit log of #62616
Previous Comments:
------------------------------------------------------------------------
[2012-07-21 14:45:46] laruence@php.net
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.
------------------------------------------------------------------------
[2012-07-21 09:05:09] laruence@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