Bug #74168 [NEW]: php://input is truncated

From: Date: Sat, 25 Feb 2017 23:46:18 +0000
Subject: Bug #74168 [NEW]: php://input is truncated
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207554@lists.php.net to get a copy of this message
From: skaownz234 at gmail dot com Operating system: Centos 7 Minimal PHP version: 7.0.16 Package: JSON related Bug Type: Bug Bug description:php://input is truncated Description: ------------ When sending JSON via php://input, my body was truncated at the point where it read <<<<<. It seems that this signals php to stop reading in from php://input. The JSON parse will fail since the truncation yields invalid JSON. I'll send the JSON blob that causes the error via the patch file. I remove the pattern /(<|>)+/ as a work around at the moment. Here's where it fails: d63da06809da5cf7c712":false},"is_super_like":false,"is_boost_match":false,"person":{"_id":"56c1d63da06809da5cf7c712","badges":[],"bio":"Why do guys put their height on here? Are we more compatible the taller we are? Let\'s test it:\\n\\n4\'10\\"\\nLibra\\nSarcastic\\nENFJ\\nType A\\nAmbitious\\nSapiosexual <<<<<<<<<<' Pretty sure the <<<'s cause this. Seems like the underlying stream processor has some sort of break condition dependent on the < symbols. Test script: --------------- POST something like { <?php $input = file_get_contents('php://input'); $j = json_decode(stripslashes(html_entity_decode($input)), true); echo json_encode($j); ?> Expected result: ---------------- All JSON data is received and retrievable via my $input variable for decoding. Actual result: -------------- JSON is truncated at an instance of '<<<<<<<<<<', rendering it invalid. -- Edit bug report at https://bugs.php.net/bug.php?id=74168&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74168&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74168&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74168&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74168&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74168&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74168&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74168&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74168&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74168&r=support Expected behavior: https://bugs.php.net/fix.php?id=74168&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74168&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74168&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74168&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74168&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74168&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74168&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74168&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74168&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74168&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74168&r=mysqlcfg

« previous php.bugs (#207554) next »