Bug #67704 [Opn]: CURLOPT_POSTFIELDS modify the type of param

From: Date: Thu, 06 Aug 2015 13:30:34 +0000
Subject: Bug #67704 [Opn]: CURLOPT_POSTFIELDS modify the type of param
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194986@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67704&edit=1

 ID:                 67704
 Updated by:         cmb@php.net
 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:

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>.


Previous Comments:
------------------------------------------------------------------------
[2015-07-18 15:51:14] cmb@php.net

FWIW, this has been fixed in PHP 7.0

------------------------------------------------------------------------
[2014-12-02 04:51:18] 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"

------------------------------------------------------------------------
[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)

« previous php.bugs (#194986) next »