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

From: Date: Tue, 20 Jul 2021 22:14:28 +0000
Subject: Bug #68004 [Opn->Csd]: SplTempFileObject and LimitIterator don't come along
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235218@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 Updated by: cmb@php.net Reported by: doldev at snowgarden dot ch Summary: SplTempFileObject and LimitIterator don't come along -Status: Open +Status: Closed Type: Bug Package: SPL related Operating System: Linux PHP Version: 5.6.0 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This is fixed[1] as of PHP 8.0.0. [1] <https://github.com/php/php-src/commit/f1d11c118dfdc911f2f33babb9b2cba8bf5acb67>. Previous Comments: ------------------------------------------------------------------------ [2014-09-11 09:46:32] doldev at snowgarden dot ch 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 ------------------------------------------------------------------------ [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 (#235218) next »