Fix the bug where clone curl does not copy POST fields. - #16556
Conversation
cmb69
left a comment
There was a problem hiding this comment.
Thank you for the PR!
I think this also affects older PHP branches; should likely target PHP-8.2.
| postfields = &clone_ch->postfields; | ||
| postfields = &ch->postfields; |
There was a problem hiding this comment.
Isn't the actual problem that we don't clone the ->postfields in the first place? I.e. ZVAL_COPY(&clone_ch->postfields, &ch->postfields).
There was a problem hiding this comment.
This code should behave consistently with PHP_FUNCTION(curl_copy_handle), with the only difference being the return value. This PR primarily aims to fix this bug, and a subsequent PR for code optimization can be submitted to implement a reusable function.
There was a problem hiding this comment.
If you clone an object, you should clone all its properties.
There was a problem hiding this comment.
I have modified the code to use ZVAL_COPY for postfields and updated PHP_FUNCTION(curl_copy_handle) to ensure consistency with the clone operation.
5d10a33 to
a0dd445
Compare
|
Updated |
No description provided.