Edit report at https://bugs.php.net/bug.php?id=72804&edit=1
ID: 72804
Updated by: [email protected]
Reported by: divinity76 at gmail dot com
Summary: docs on rewind explicitly says it must be opened by
fopen()
Status: Open
Type: Documentation Problem
Package: Filesystem function related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
> the Iterable pseudo-type is still in the manual
Ah, good catch! Iterable is, however, not a pseudo-type, but
rather a real type, see <https://3v4l.org/qGS61> (it is not an
interface, though). The docs need to be fixed in that regard.
Previous Comments:
------------------------------------------------------------------------
[2021-08-03 14:04:09] test at test dot test
@cmb the Iterable pseudo-type is still in the manual, quoting https://www.php.net/manual/en/language.types.iterable.php: Iterable is a pseudo-type introduced in PHP 7.1.
------------------------------------------------------------------------
[2021-07-29 10:57:52] [email protected]
Hmm, we just got rid of all pseudo types in the manual, and given
that resources are considered obsolete and a lot of work has
already been done to convert many of them to objects, I don't
think that introducing a pseudo type for streams makes much sense
at this point.
------------------------------------------------------------------------
[2016-08-10 21:13:47] [email protected]
It works on all streams (that support seeking).
fclose, feof, fflush... It looks like most of the functions specifically call out fopen or fsockopen. Given how prevalent streams are, could they warrant their own pseudotype in the manual?
------------------------------------------------------------------------
[2016-08-10 13:25:24] divinity76 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.rewind
---
quote: The file pointer must be valid, and must point to a file successfully opened by fopen().
rewind also works fine on files opened by tmpfile(), so at the very least, the docs should say "opened by fopen() or tmpfile()", if there isn't more. (PS: there is a similar problem with the docs for "ftell")
Test script:
---------------
<?php
$h=tmpfile();
var_dump(ftell($h));
fwrite($h,'PHP');
var_dump(ftell($h));
rewind($h);
var_dump(ftell($h));
Expected result:
----------------
int(0)
int(3)
int(3)
Actual result:
--------------
int(0)
int(3)
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72804&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.