Doc #60464 [Csd]: fseek documention incorrect
| From: | mfonda@php.net | Date: | Wed, 07 Dec 2011 23:56:49 +0000 |
| Subject: | Doc #60464 [Csd]: fseek documention incorrect | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7618@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60464&edit=1
ID: 60464
Updated by: mfonda@php.net
Reported by: df1986 at aol dot com
Summary: fseek documention incorrect
Status: Closed
Type: Documentation Problem
Package: Filesystem function related
Operating System: All
PHP Version: Irrelevant
Assigned To: frozenfire
Block user comment: N
Private report: N
New Comment:
I think the docs were actually correct here. fseek will return -1 if the seek
fails, and 0 upon success. It will return false in the case of invalid arguments,
such as the example below.
Previous Comments:
------------------------------------------------------------------------
[2011-12-07 23:34:11] frozenfire@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
By the way, don't use json_encode for debugging. It's bound to screw you up. Use
var_dump instead.
------------------------------------------------------------------------
[2011-12-07 23:33:32] frozenfire@php.net
Automatic comment from SVN on behalf of frozenfire
Revision: http://svn.php.net/viewvc/?view=revision&revision=320620
Log: Fixed return value. Closed bug #60464.
------------------------------------------------------------------------
[2011-12-07 22:05:05] df1986 at aol dot com
Description:
------------
---
From manual page: http://www.php.net/function.fseek#refsect1-function.fseek-returnvalues
---
Docs say fseek returns -1 on error, actually returns false.
Test script:
---------------
//Invalid resource
echo json_encode(fseek('', 52));//outputs false
//Dangling resource
$f = fopen('somefile', 'r');//to get a valid resource
fclose($f);//to make it dangle
echo json_encode(fseek($f, 52));//outputs false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60464&edit=1