ID:               32371
 Updated by:       [EMAIL PROTECTED]
 Reported By:      phpint-bkrrym at skrt dot org
 Status:           Assigned
 Bug Type:         Filesystem function related
 Operating System: *
 PHP Version:      5CVS, 4CVS (2005-03-19)
-Assigned To:      wez
+Assigned To:      pollita
 New Comment:

Sara, could you take a look at this?
It seems ok, but I don't have time to verify it.


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

Reply via email to