Skip to content

Keep consistent EG(current_execute_data) after return from generator #11380

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

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Jun 6, 2023

No description provided.

@dstogov dstogov requested review from iluuu1994 and bwoebi June 6, 2023 11:10
@dstogov dstogov changed the base branch from master to PHP-8.1 June 6, 2023 11:12
Copy link
Member

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

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

Apart from ensuring consistency, this also has the side effect, that variable destruction occurs on top of the the previous frame, which is consistent with zend_leave_helper behaviour.

@dstogov
Copy link
Member Author

dstogov commented Jun 6, 2023

The main problem - zend_generator_close() may free execute_data and make EG(current_execute_data) to be a dangling pointer.
The change in context of destructors was unintended but it seems right.

@dstogov dstogov merged commit 06d6873 into php:PHP-8.1 Jun 8, 2023
dstogov added a commit that referenced this pull request Jun 8, 2023
* PHP-8.1:
  Keep consistent EG(current_execute_data) after return from generator (#11380)
dstogov added a commit that referenced this pull request Jun 8, 2023
* PHP-8.2:
  Keep consistent EG(current_execute_data) after return from generator (#11380)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants