#47371 [NEW]: fseek: Description of negative offset use is not clear

From: Date: Thu, 12 Feb 2009 16:27:47 +0000
Subject: #47371 [NEW]: fseek: Description of negative offset use is not clear
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1844@lists.php.net to get a copy of this message
From:             sammywg@php.net
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  fseek: Description of negative offset use is not clear

Description:
------------
If you want to use negative fseek offset, it is not enough to use a
negative offset as second parameter, also the third parameter must be
specified as SEEK_END. The documentation should note that fact, currently
it appears as if a function call like 

$i = fseek($filehandle, -100); 

would be adequate.

Reproduce code:
---------------
http://php.net/fseek

Expected result:
----------------
To move to a position before the end-of-file, you need to pass a negative
value in offset and set the whence parameter to SEEK_END. 

Actual result:
--------------
To move to a position before the end-of-file, you need to pass a negative
value in offset . 

-- 
Edit bug report at http://bugs.php.net/?id=47371&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47371&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47371&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47371&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47371&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47371&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47371&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47371&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47371&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47371&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47371&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47371&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47371&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47371&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47371&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47371&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47371&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47371&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47371&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47371&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47371&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47371&r=mysqlcfg



Thread (2 messages)

« previous php.doc.bugs (#1844) next »