#32371 [Opn->Asn]: [PATCH] php://input sometimes returns dupl data
| From: | tony2001@php.net | Date: | Sat, 19 Mar 2005 15:59:23 +0000 |
| Subject: | #32371 [Opn->Asn]: [PATCH] php://input sometimes returns dupl data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75525@lists.php.net to get a copy of this message | ||
ID: 32371
Updated by: tony2001@php.net
Reported By: phpint-bkrrym at skrt dot org
-Status: Open
+Status: Assigned
Bug Type: Filesystem function related
Operating System: *
PHP Version: 4CVS, 5CVS (2005-03-19)
-Assigned To:
+Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2005-03-19 02:25:49] phpint-bkrrym at skrt dot org
Description:
------------
Full description and PATCH for 5-CVS and 4.3.10 are here:
http://thepathetic.com/jozef/php_input_stream_patch.html
http://thepathetic.com/jozef/php-5.0.3-input_stream.patch
http://thepathetic.com/jozef/php-4.3.10-input_stream.patch
Both 5 and 4.3.10 have the problem (same code).
Because of a subtle buffer index bug, in some cases, the php://input
stream returns incorrect data.
Symptoms:
If the php://input is parsed in 4000-byte chunks, the first corruption
occurs at byte number 8193 (1-based). A chunk of the previous 192 bytes
repeats there. The same corruption happens periodically in the data if
it is long enough.
The problem was discovered when directly parsing a POSTed XML with a
long text-node.
Interestingly enough, reading the contents of php://input with
file_get_contents and parsing the string works around the symptoms.
Reproduce code:
---------------
$s = simplexml_load_file('php://input');
sees the text node corrupted, whereas
$d = file_get_contents('php://input');
$s = simplexml_load_string($d);
does not.
Expected result:
----------------
should be the same in both cases
Actual result:
--------------
difference at byte number 8193 (1-based) from the begining of the xml.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32371&edit=1