File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ PHP NEWS
99 . Fixed bug GH-19792 (SCCP causes UAF for return value if both warning and
1010 exception are triggered). (nielsdos)
1111
12+ - Curl:
13+ . Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
14+ of the curl_copy_handle() function to clone a CurlHandle.
15+
1216- Standard:
1317 . Fixed bug GH-12265 (Cloning an object breaks serialization recursion).
1418 (nielsdos)
Original file line number Diff line number Diff line change @@ -468,7 +468,7 @@ static zend_object *curl_clone_obj(zend_object *object) {
468468 clone_ch -> cp = cp ;
469469 _php_setup_easy_copy_handlers (clone_ch , ch );
470470
471- postfields = & clone_ch -> postfields ;
471+ postfields = & ch -> postfields ;
472472 if (Z_TYPE_P (postfields ) != IS_UNDEF ) {
473473 if (build_mime_structure_from_hash (clone_ch , postfields ) == FAILURE ) {
474474 zend_throw_exception (NULL , "Failed to clone CurlHandle" , 0 );
Original file line number Diff line number Diff line change 1+ --TEST--
2+ clone() allows to post CURLFile multiple times
3+ --EXTENSIONS--
4+ curl
5+ --FILE--
6+ <?php
7+ include 'server.inc ' ;
8+ $ host = curl_cli_server_start ();
9+
10+ $ ch1 = curl_init ();
11+ curl_setopt ($ ch1 , CURLOPT_SAFE_UPLOAD , 1 );
12+ curl_setopt ($ ch1 , CURLOPT_URL , "{$ host }/get.php?test=file " );
13+ curl_setopt ($ ch1 , CURLOPT_RETURNTRANSFER , 1 );
14+
15+ $ filename = __DIR__ . '/curl_copy_handle_variation3_clone.txt ' ;
16+ file_put_contents ($ filename , "Test. " );
17+ $ file = curl_file_create ($ filename );
18+ $ params = array ('file ' => $ file );
19+ var_dump (curl_setopt ($ ch1 , CURLOPT_POSTFIELDS , $ params ));
20+
21+ $ ch2 = clone ($ ch1 );
22+
23+ var_dump (curl_exec ($ ch1 ));
24+
25+ var_dump (curl_exec ($ ch2 ));
26+ ?>
27+ --EXPECTF--
28+ bool(true)
29+ string(%d) "curl_copy_handle_variation3_clone.txt|application/octet-stream|5"
30+ string(%d) "curl_copy_handle_variation3_clone.txt|application/octet-stream|5"
31+ --CLEAN--
32+ <?php
33+ @unlink (__DIR__ . '/curl_copy_handle_variation3_clone.txt ' );
34+ ?>
You can’t perform that action at this time.
0 commit comments