Bug #55767 [Com]: CURLOPT_POSTFIELDS Ignores Numeric Field Names
| From: | mat999 at gmail dot com | Date: | Sat, 22 Oct 2011 14:39:09 +0000 |
| Subject: | Bug #55767 [Com]: CURLOPT_POSTFIELDS Ignores Numeric Field Names | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164513@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55767&edit=1
ID: 55767
Comment by: mat999 at gmail dot com
Reported by: brad at hostland dot com
Summary: CURLOPT_POSTFIELDS Ignores Numeric Field Names
Status: Closed
Type: Bug
Package: cURL related
Operating System: Linux
PHP Version: 5.3.8
Assigned To: rasmus
Block user comment: N
Private report: N
New Comment:
seconded, I cant see any reason for it to be a BC break either.
Previous Comments:
------------------------------------------------------------------------
[2011-09-23 22:41:06] brad at hostland dot com
Is there any way this can be fixed in 5.3? This is causing me big problems and I'm unable to
install 5.4 at this time.
------------------------------------------------------------------------
[2011-09-23 13:21:42] rasmus@php.net
Fixed in 5.4 and trunk. Need to have a closer look to see if it might be a BC
break in 5.3
------------------------------------------------------------------------
[2011-09-23 13:16:18] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=317201
Log: Fix for bug #55767
------------------------------------------------------------------------
[2011-09-23 07:41:34] brad at hostland dot com
Description:
------------
If you use a numeric array key to represent a numeric field name, cURL will ignore the field
completely when submitting the POST.
For example, suppose you have an HTML form containing a field named 'somefield' and
another field named '100'. We want to simulate submitting this form using cURL:
When the script below is executed, cURL will submit the form and pass the 'somefield'
data, but will completely ignore the '100' data in the form post.
$ch = curl_init('http://www.someurl.com');
curl_setopt($ch, CURLOPT_POST, 1);
$fields['somefield'] = 'Some Data';
$fields['100'] = 'Some Other Data';
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$output = curl_exec($ch);
Test script:
---------------
$ch = curl_init('http://www.someurl.com');
curl_setopt($ch, CURLOPT_POST, 1);
$fields['somefield'] = 'Some Data';
$fields['100'] = 'Some Other Data';
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$output = curl_exec($ch);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55767&edit=1