Bug #72131 [NEW]: Calling number_format(null) causes curl to not decode chunks

From: Date: Fri, 29 Apr 2016 22:46:19 +0000
Subject: Bug #72131 [NEW]: Calling number_format(null) causes curl to not decode chunks
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200838@lists.php.net to get a copy of this message
From: andre at webkr dot de Operating system: Linux PHP version: 5.5.35 Package: Reproducible crash Bug Type: Bug Bug description:Calling number_format(null) causes curl to not decode chunks Description: ------------ This bug exists in PHP 5.5.35, PHP 5.6.21 and PHP 7.0.6. When you make repeated curl requests to a server that returns the answer chunked-encoded, those requests start to fail with the error "Problem (2) in the Chunked-Encoded data" as soon as you call number_format(null). Admittedly number_format(null) makes no sense, but it throws no error either. When you call number_format(null) a second time, cURL can decode chunks again, a third time again brings the error, and so on. Test script: --------------- $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://localhost/'); // This URL must return a chunked response curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); for($i = 0 ; $i < 10 ; $i++) { $result = curl_exec($ch); var_dump($result); var_dump(curl_error($ch)); if($i >= 2) { echo "\n" . 'number_format(null) called' . "\n"; number_format(null); } echo "\n"; } Expected result: ---------------- (Created by requesting a URL that does not respond in chunks) string(2) "OK" string(0) "" string(2) "OK" string(0) "" string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called string(2) "OK" string(0) "" number_format(null) called Actual result: -------------- string(2) "OK" string(0) "" string(2) "OK" string(0) "" string(2) "OK" string(0) "" number_format(null) called bool(false) string(39) "Problem (2) in the Chunked-Encoded data" number_format(null) called string(2) "OK" string(0) "" number_format(null) called bool(false) string(39) "Problem (2) in the Chunked-Encoded data" number_format(null) called string(2) "OK" string(0) "" number_format(null) called bool(false) string(39) "Problem (2) in the Chunked-Encoded data" number_format(null) called string(2) "OK" string(0) "" number_format(null) called bool(false) string(39) "Problem (2) in the Chunked-Encoded data" number_format(null) called -- Edit bug report at https://bugs.php.net/bug.php?id=72131&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72131&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72131&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72131&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72131&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72131&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72131&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72131&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72131&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72131&r=support Expected behavior: https://bugs.php.net/fix.php?id=72131&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72131&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72131&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72131&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72131&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72131&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72131&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72131&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72131&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72131&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72131&r=mysqlcfg

« previous php.bugs (#200838) next »