Skip to content

Fix incorrect check condition in ZEND_YIELD #10332

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

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

Here's a subtle bug.
The condition UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE always returned false, because UNEXPECTED(expression) always returns 0 or 1. Move the parens so the comparison is executed properly.

Note: I found this using a static analyser, and manually verified that the report is in fact a real bug. After fixing this the analyser no longer complains.

The condition `UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE` always
returned false, because `UNEXPECTED(expression)` always returns 0 or 1.
Move the parens so the comparison is executed properly.
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.

Oh, very good finding! Thank you!

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.

2 participants