Bug #68004 [Opn]: SplTempFileObject and LimitIterator don't come along

From: Date: Thu, 11 Sep 2014 09:46:33 +0000
Subject: Bug #68004 [Opn]: SplTempFileObject and LimitIterator don't come along
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187517@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68004&edit=1 ID: 68004 User updated by: doldev at snowgarden dot ch Reported by: doldev at snowgarden dot ch Summary: SplTempFileObject and LimitIterator don't come along Status: Open Type: Bug Package: SPL related Operating System: Linux PHP Version: 5.6.0 Block user comment: N Private report: N New Comment: Example: http://3v4l.org/AJBR9 Don't worry about the output of HHVM -> it has been fixed recently https://github.com/facebook/hhvm/issues/2993 Previous Comments: ------------------------------------------------------------------------ [2014-09-11 09:41:31] doldev at snowgarden dot ch Description: ------------ If SplTempFileObject used with the LimitIterator in some cases it behave wrong. This might be related to #65600 . Even though if switching to an SplFileObject fixes the problem with the same input. Test script: --------------- <?php $content = <<<'EOF' Line 1 Line 2 Line 3 Line 4 EOF; $tmpCsvFile = new SplTempFileObject(); $tmpCsvFile->fwrite($content); $iterator = new CallbackFilterIterator($tmpCsvFile, function ($row) { return true; }); echo 'Limit 1: ', iterator_count(new LimitIterator($iterator, 2)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 2)), "\n"; echo 'Limit 2: ', iterator_count(new LimitIterator($iterator, 3)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 3)), "\n"; Expected result: ---------------- Limit 2: 2 2 Limit 3: 1 1 Actual result: -------------- Limit 2: 2 2 Limit 3: 1 0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68004&edit=1

« previous php.bugs (#187517) next »