php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67704 CURLOPT_POSTFIELDS modify the type of param
Submitted: 2014-07-29 06:36 UTC Modified: 2018-03-10 23:56 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: redfoxli069 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: cURL related
PHP Version: 5.4.31 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: redfoxli069 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-07-29 06:36 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-02 04:51 UTC] redfoxli069 at gmail dot com
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"
 [2015-07-18 15:51 UTC] cmb@php.net
FWIW, this has been fixed in PHP 7.0
 [2015-08-06 13:30 UTC] cmb@php.net
I just noticed that there is a respective PR (can't add it via
"Add a Pull Request"): <https://github.com/php/php-src/pull/927>.
 [2018-03-10 23:56 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-03-10 23:56 UTC] cmb@php.net
Closing, since PHP 5 is out of active support, and the issue has
already been fixed as of PHP 7.0.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 22:01:32 2024 UTC