php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71225 curl_setopt() fails to set CURLOPT_POSTFIELDS with reference to CURLFile
Submitted: 2015-12-27 06:16 UTC Modified: 2015-12-27 07:00 UTC
From: bugs dot php dot net at ss dot st dot tc Assigned:
Status: Closed Package: cURL related
PHP Version: 7.0.1 OS: Linux, OS X
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bugs dot php dot net at ss dot st dot tc
New email:
PHP Version: OS:

 

 [2015-12-27 06:16 UTC] bugs dot php dot net at ss dot st dot tc
Description:
------------
PHP 5 acts as expected, PHP 7 fails.

Test script:
---------------
<?php

$post_data_1 = [ 'file' => new CURLFile('file.txt') ];
$curl_1 = curl_init();
curl_setopt($curl_1, CURLOPT_POSTFIELDS, $post_data_1);
echo "OK\n";

// exactly the same as above + added a reference to 'file' element
$post_data_2 = [ 'file' => new CURLFile('file.txt') ];
$ref = & $post_data_2['file']; // ***
$curl_2 = curl_init();
curl_setopt($curl_2, CURLOPT_POSTFIELDS, $post_data_2);
echo "OK\n";


Expected result:
----------------
PHP 5:

OK
OK


PHP 7:

OK
OK


Actual result:
--------------
PHP 5:

OK
OK


PHP 7:

OK
Catchable fatal error: Object of class CURLFile could not be converted to string in wtf.php on line 12


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-27 06:56 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2453a48ab56f25c0900a5baa917cedc88db8e3e1
Log: Fixed bug #71225 (curl_setopt() fails to set CURLOPT_POSTFIELDS with reference to CURLFile)
 [2015-12-27 06:56 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-12-27 07:00 UTC] bugs dot php dot net at ss dot st dot tc
That was fast :) Thanks Laruence!
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2453a48ab56f25c0900a5baa917cedc88db8e3e1
Log: Fixed bug #71225 (curl_setopt() fails to set CURLOPT_POSTFIELDS with reference to CURLFile)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC