From:             zoeslam at gmail dot com
Operating system: Ubuntu 12.04
PHP version:      5.4.5
Package:          SPL related
Bug Type:         Bug
Bug description:IteratorIterator doesn't delegate count() method

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 bug report at https://bugs.php.net/bug.php?id=62629&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62629&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62629&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62629&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62629&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62629&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62629&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62629&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62629&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62629&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62629&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62629&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62629&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62629&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62629&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62629&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62629&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62629&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62629&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62629&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62629&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62629&r=mysqlcfg

Reply via email to