Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix the bug where clone curl does not copy POST fields. #16556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matyhtf wants to merge 1 commit into php:master
base: master
Choose a base branch
Loading
from matyhtf:fix-curl-handle-clone

Conversation

Copy link
Contributor

@matyhtf matyhtf commented Oct 23, 2024

No description provided.

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

I think this also affects older PHP branches; should likely target PHP-8.2.

_php_setup_easy_copy_handlers(clone_ch, ch);

postfields = &clone_ch->postfields;
postfields = &ch->postfields;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

postfields = &ch->postfields;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you clone an object, you should clone all its properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

matyhtf commented Nov 26, 2024

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@cmb69 cmb69 cmb69 left review comments

@adoy adoy Awaiting requested review from adoy adoy is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /