|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-01-12 16:17 UTC] ab@php.net
-Status: Open
+Status: Feedback
[2018-01-12 16:17 UTC] ab@php.net
[2018-02-09 12:32 UTC] ab@php.net
-Status: Feedback
+Status: Duplicate
[2018-02-09 12:32 UTC] ab@php.net
[2018-02-09 15:27 UTC] peter at grootplezier dot nl
-Status: Duplicate
+Status: Closed
[2018-02-09 15:27 UTC] peter at grootplezier dot nl
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 20:00:01 2025 UTC |
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