Doc #72804 [Opn]: docs on rewind explicitly says it must be opened by fopen()

From: Date: Thu, 29 Jul 2021 10:57:52 +0000
Subject: Doc #72804 [Opn]: docs on rewind explicitly says it must be opened by fopen()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19002@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72804&edit=1 ID: 72804 Updated by: cmb@php.net 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: 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. Previous Comments: ------------------------------------------------------------------------ [2016-08-10 21:13:47] requinix@php.net 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

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