#32371 [NEW]: [PATCH] php://input sometimes returns dupl data
| From: | phpint-bkrrym at skrt dot org | Date: | Sat, 19 Mar 2005 01:25:50 +0000 |
| Subject: | #32371 [NEW]: [PATCH] php://input sometimes returns dupl data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75507@lists.php.net to get a copy of this message | ||
From: phpint-bkrrym at skrt dot org
Operating system: any
PHP version: 5CVS-2005-03-19 (dev)
PHP Bug Type: Filesystem function related
Bug description: [PATCH] php://input sometimes returns dupl data
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 bug report at http://bugs.php.net/?id=32371&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32371&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32371&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32371&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32371&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32371&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32371&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32371&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32371&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32371&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32371&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32371&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32371&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32371&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32371&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32371&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32371&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32371&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32371&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32371&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32371&r=mysqlcfg