|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-02-04 02:00 UTC] madhusudancs at gmail dot com
-Summary: Using SEEK_CUR to seek behind start in a produces
incorrect result
+Summary: Using SEEK_CUR to seek before start in php://memory
produces incorrect results
[2014-02-04 02:00 UTC] madhusudancs at gmail dot com
[2014-02-04 12:34 UTC] krakjoe@php.net
-Status: Open
+Status: Not a bug
[2014-02-04 12:34 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 11:00:01 2025 UTC |
Description: ------------ When using php://memory stream, attempting to seek behind the start position, produces incorrect results. Sample test case below (in the next field) Test case should print the entire stream (all the bytes in the stream, but it prints an empty string. Test script: --------------- <?php $fh = fopen('php://memory', 'w'); for ($ii = 0; $ii < 10; $ii++) { fwrite($fh, "[$ii] hello world. "); } $sz = 170; fseek($fh, $sz - 100, SEEK_SET); fseek($fh, -$sz, SEEK_CUR); var_dump(fread($fh, $sz)); ?> Expected result: ---------------- string(170) "[0] hello world. [1] hello world. [2] hello world. [3] hello world. [4] hello world. [5] hello world. [6] hello world. [7] hello world. [8] hello world. [9] hello world. " Actual result: -------------- string(0) ""