From:             hanskrentel at yahoo dot de
Operating system: Windows
PHP version:      5.4.9
Package:          SPL related
Bug Type:         Bug
Bug description:iterator_count loves SplFileObject too much (endless)

Description:
------------
For some reason not clear to me, using iterator_count with the iterator
interface 
of SplFileObject (as well with SplTempFileObject) results in an endless
running 
script.

Test script:
---------------
<?php
$test = new SplFileObject("data://text/plain,1\n2");
$test->setFlags(SplFileObject::DROP_NEW_LINE);
echo "Values: [", implode(', ', iterator_to_array($test)),
     "]\nCount: ", iterator_count($test), "\n";
?>

-- OR --

<?php
$test = new SplTempFileObject();
$test->setFlags(SplTempFileObject::DROP_NEW_LINE);
$test->fwrite("1\n2");
echo "Values: [", implode(', ', iterator_to_array($test)),
     "]\nCount: ", iterator_count($test), "\n";
?>

Expected result:
----------------
Values: [1, 2]
Count: 2

Actual result:
--------------
Values: [1, 2]
Count: 

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

Reply via email to