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

[email protected] ("imjohneric at mail dot com") Sun, 22 Jan 2023 16:07:28 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
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] [email protected]

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] [email protected]

Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&amp;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