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

From: Date: Sat, 18 Jul 2015 15:51:15 +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-194534@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: FWIW, this has been fixed in PHP 7.0 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#194534) next »