Skip to content
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

Fix install_hook on functions returning by-reference #2017

Merged
merged 2 commits into from
Apr 20, 2023

Conversation

bwoebi
Copy link
Collaborator

@bwoebi bwoebi commented Apr 19, 2023

Description

Two issues:

  • IS_VAR passed to ZEND_RETURN(_BY_REF) on PHP 7 may be IS_INDIRECT. When copying these, we must ensure to not copy the IS_INDIRECT itself. It largely was unproblematic, but manipulating $hookData->returned could have unexpected side effects.
  • On PHP 8 we need to track type sources as the $returned property is typed mixed and thus, the type source needs to be carried around. Otherwise we run into an assertion failure.

Note that these changes on the PHP 7 side also enable changing the return value (on PHP 8 no extra handling is needed).

Readiness checklist

  • (only for Members) Changelog has been added to the release document.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the release document. For community contributors the reviewer is in charge of this task.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi bwoebi added this to the 0.87.0 milestone Apr 19, 2023
@bwoebi bwoebi requested a review from a team as a code owner April 19, 2023 13:30
@bwoebi bwoebi merged commit 4ea71b2 into master Apr 20, 2023
@bwoebi bwoebi deleted the bob/fix-by-ref-install-hook branch April 20, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants