From:
Operating system: Linux
PHP version: 5.3.2
Package: Streams related
Bug Type: Bug
Bug description:fseek($fp, 0, SEEK_CUR) generates needless warning when seeking
isn't supported
Description:
------------
This is such a minor "bug" which can easily be fixed with one minor
change.
The bzip stream for example, does not support seeking, however this is an
"emulation" in main/streams/streams.c that allows the SEEK_CUR to work with
positive values by just continue to read for the seek duration.
The bug is if you use SEEK_CUR with a value of zero, a warning pops up
saying
seek is not supported. I know using a value of zero is perhaps wrong, but
by
changing line 1150 of main/streams/streams.c from:
if (whence == SEEK_CUR && offset > 0) {
to:
if (whence == SEEK_CUR && offset >= 0) {
then this warning does not appear, and everything works as expected.
I have not tested this change, but it looks innocent enough. Until then I'm
writing my PHP code with a if ($offset > 0) fseek($fp, $offset, SEEK_CUR);
thanks.
--
Edit bug report at http://bugs.php.net/bug.php?id=51997&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51997&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51997&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=51997&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=51997&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51997&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51997&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51997&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51997&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51997&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51997&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51997&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51997&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51997&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51997&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51997&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51997&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51997&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51997&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51997&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51997&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51997&r=mysqlcfg