Bug #75764 [Fbk->Dup]: cUrl post large data goes wrong

From: Date: Fri, 09 Feb 2018 12:32:19 +0000
Subject: Bug #75764 [Fbk->Dup]: cUrl post large data goes wrong
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213887@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75764&edit=1 ID: 75764 Updated by: ab@php.net Reported by: peter at grootplezier dot nl Summary: cUrl post large data goes wrong -Status: Feedback +Status: Duplicate Type: Bug Package: cURL related Operating System: Windows PHP Version: 7.2.1 Block user comment: N Private report: N New Comment: See bug #75597. Thanks. Previous Comments: ------------------------------------------------------------------------ [2018-01-12 16:28:08] ab@php.net Related To: Bug #75597 ------------------------------------------------------------------------ [2018-01-12 16:17:21] ab@php.net Thanks for the report. Please check a latest snapshot. Be sure it's a one with libcurl 7.57.0. Thanks. ------------------------------------------------------------------------ [2018-01-05 10:16:03] peter at grootplezier dot nl Description: ------------ Tested with: PHP 7.1.10 and curl 7.56.0 The script works with curl 7.54.0 correctly. Works in the newest curl version. But this is still not implemented in the Windows version of PHP. Test script: --------------- <?php //generate string data function getStr($num) { $bstring = 'abcdefghijklmnopqrstuvxyz0123456789'; $str = ''; for($i = 0; $i < $num; $i++) { $str .= $bstring; } return $str; } $json = [ 'json1' => getStr(200), 'json2' => getStr(200), 'json3' => getStr(200), 'json4' => getStr(200), ]; $post = [ 'test1' => 'a', 'test2' => 'b', 'test3' => 'c', 'test4' => json_encode($json) //or use print_r or var_dump with return parameter ]; $ch = curl_init(); //send encoded json-data to service curl_setopt($ch, CURLOPT_URL, 'https://localhost/service.php'); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec ($ch); curl_close($ch); var_dump($result); ?> service.php -------------------------------------------------------------------------------------- <?php //get the post data and write into request.log $result = file_put_contents('request.log', print_r($_REQUEST, true)); var_dump($result); //the content of $_REQUEST is wrong, json1 is repeated, content is cutted off //expected result: correct content in $_REQUEST ?> Expected result: ---------------- Correct post data in $_REQUEST. Actual result: -------------- the content of $_REQUEST is wrong, json1 is repeated, content is cutted off, the post data is corrupt ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75764&edit=1

« previous php.bugs (#213887) next »