Bug #67704 [Com]: CURLOPT_POSTFIELDS modify the type of param
Edit report at https://bugs.php.net/bug.php?id=67704&edit=1
ID: 67704
Comment by: redfoxli069 at gmail dot com
Reported by: redfoxli069 at gmail dot com
Summary: CURLOPT_POSTFIELDS modify the type of param
Status: Open
Type: Bug
Package: cURL related
Operating System: Linux
PHP Version: 5.4.31
Block user comment: N
Private report: N
New Comment:
CURLOPT_HTTPHEADER or CURLOPT_QUOTE or CURLOPT_HTTP200ALIASES or CURLOPT_POSTQUOTE or
CURLOPT_PREQUOTE or CURLOPT_TELNETOPTIONS or CURLOPT_MAIL_RCPT or CURLOPT_RESOLVE has the sample
problem, also modify the type of param
Test script:
---------------
$ch = curl_init();
$header = array('a' => 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
var_dump($header['a']);
curl_close($ch);
Expected result:
----------------
int(1)
Actual result:
--------------
string(1) "1"
Previous Comments:
------------------------------------------------------------------------
[2014-07-29 06:36:15] redfoxli069 at gmail dot com
Description:
------------
CURLOPT_POSTFIELDS modify the type of param
e.gï¼the type of $post_data['a'] from int to string it the "TEST script"
Test script:
---------------
$ch = curl_init();
$post_data = array('a' => 1, 'b' => '2');
if($post_data['a'] === 1)
echo "yes\n";
else
echo "no\n";
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
if($post_data['a'] === 1)
echo "yes\n";
else
echo "no\n";
Expected result:
----------------
yes
yes
Actual result:
--------------
yes
no
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67704&edit=1
Thread (5 messages)