Bug #68481 [NEW]: feof true on php://temp one byte early

From: Date: Sat, 22 Nov 2014 23:14:36 +0000
Subject: Bug #68481 [NEW]: feof true on php://temp one byte early
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188746@lists.php.net to get a copy of this message
From: tim_siebels_aurich at yahoo dot de Operating system: Tested on Ubuntu PHP version: 5.6.3 Package: Streams related Bug Type: Bug Bug description:feof true on php://temp one byte early Description: ------------ To get feof return true you need to read length+1 bytes you wrote. Or in general it returns true after you tried to read beyond the last byte. the php://temp (and php://memory too) stream however returns true after length bytes read. Test script: --------------- <?php // Test File Stream $file = tempnam('/tmp', 'feoftest'); $h = fopen("php://temp", 'r+'); fwrite($h, "bug"); fseek($h, 0); fread($h, 3); var_dump(feof($h)); // Test Temp Stream $h = fopen("php://temp", 'r+'); fwrite($h, "bug"); fseek($h, 0); fread($h, 3); var_dump(feof($h)); Expected result: ---------------- bool(false) bool(false) Actual result: -------------- bool(false) bool(true) -- Edit bug report at https://bugs.php.net/bug.php?id=68481&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68481&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68481&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68481&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68481&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68481&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68481&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68481&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68481&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68481&r=support Expected behavior: https://bugs.php.net/fix.php?id=68481&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68481&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68481&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68481&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68481&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68481&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68481&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68481&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68481&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68481&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68481&r=mysqlcfg

« previous php.bugs (#188746) next »