php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75597 CURLOPT_POSTFIELDS large string incorrect send
Submitted: 2017-11-30 14:12 UTC Modified: 2018-02-09 12:31 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: icorrea at cristalmedia dot net Assigned: ab (profile)
Status: Closed Package: cURL related
PHP Version: 7.2.0 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: icorrea at cristalmedia dot net
New email:
PHP Version: OS:

 

 [2017-11-30 14:12 UTC] icorrea at cristalmedia dot net
Description:
------------
---
From manual page: http://www.php.net/function.curl-setopt
---
PHP 7.2.0 and PHP 7.1

When send a large string, for example a base64 encoded image, by POST and set the parameter using CURLOPT_POSTFIELDS, cURL cut the string and send a repeted string to the original length of the string. 

Example:
$string = array(0 => "ABCDEFGHIJKLMN.."); // test with a string > 20000 length
..
curl_setopt($s, CURLOPT_POST, true);
curl_setopt($s, CURLOPT_POSTFIELDS, $string );
...

then on other side the server recive:

"ABCDEFABCDEFABCD.."

cuting the string in 16K size and repeated any times to complete the original size.

Test the same code with PHP5 and this bug is not present.



Test script:
---------------
$string = array(0 => "ABCDEFGHIJKLMN.."); // test with a string > 20000 length
..
curl_setopt($s, CURLOPT_POST, true);
curl_setopt($s, CURLOPT_POSTFIELDS, $string );
...

then on other side the server recive:

"ABCDEFABCDEFABCD.."


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-01 10:09 UTC] mb dot php dot net at osps dot net
I can confirm the following versions apply:
- problem occurs Windows 32, x64, Thread Safe, 7.1.12
- problem does NOT occur Windows 32, x64, Thread Safe, 7.1.2
 [2017-12-13 08:56 UTC] peter at grootplezier dot nl
This problem is fixed in version 7.56.1 - October 23 2017. Can this be included in the next version please.
 [2018-01-08 09:57 UTC] c dot bermon at eona dot com
Agree with Peter, CURL must be updated. Bug present from PHP 7.1.11
 [2018-01-12 16:28 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-01-12 16:28 UTC] ab@php.net
Thanks for the report. Please check the latest snapshot. Likely bug #75764 is also related.

Thanks.
 [2018-02-02 14:10 UTC] c dot bermon at eona dot com
Solved with PHP 7.1.14, thanks!
 [2018-02-09 12:31 UTC] ab@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: ab
 [2018-02-09 12:31 UTC] ab@php.net
Thanks for the checks. Seems we can close this now.

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 15:01:32 2025 UTC