Doc #52180 [Com]: php://input can be read more than once

From: Date: Sun, 22 Jan 2023 16:07:28 +0000
Subject: Doc #52180 [Com]: php://input can be read more than once
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19559@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=52180&edit=1 ID: 52180 Comment by: imjohneric at mail dot com Reported by: deceze at gmail dot com Summary: php://input can be read more than once Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Assigned To: cataphract Block user comment: N Private report: N New Comment: Thanks for the help. useful. (https://txtaghelp.com).github.com Previous Comments: ------------------------------------------------------------------------ [2010-09-08 12:53:27] cataphract@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. ------------------------------------------------------------------------ [2010-09-08 12:53:01] cataphract@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=303169 Log: - php://input and how many times it can be read. - Closes bug #52180 ------------------------------------------------------------------------ [2010-06-25 08:01:06] deceze at gmail dot com Correction: The manual entry seems to be correct regarding PUT requests, whereas POST requests can be read many times. Can the documentation be improved with more details about what works when? ------------------------------------------------------------------------ [2010-06-25 03:20:19] deceze at gmail dot com Description: ------------ The input/output streams documentations warns that "Note: php://input can only be read once." (http://php.net/manual/en/wrappers.php.php) This doesn't appear to be correct. php://input can be read once *per handle*. The documentation is misleading and should be reworded. Test script: --------------- // This will work: file_get_contents('php://input'); file_get_contents('php://input'); // This won't: $in = fopen('php://input', 'r'); fread($in, 1024); fseek($in, 0); fread($in, 1024); fclose($in); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=52180&edit=1

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