-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix(php_set_attribute_id): fix incorrect ID removal, when is_id == 1 #7482
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
Conversation
Please open up a bug report at https://bugs.php.net and add a regression test as a file. |
I made a bug report and I will prepare a regression test. What I'm not sure about, is whether this fix for PHP-7.4 will be enough. In fact this bug is reproduced in versions 5.x-8.x |
ext/dom/tests/bug81433.phpt
Outdated
--CLEAN-- | ||
<?php | ||
unlink(__DIR__ . '/81433.html'); | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This --CLEAN--
section is unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix looks good, thank you!
Note that versions prior to PHP-7.4 are no longer actively supported, so targeting PHP-7.4 is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I'll merge this soon.
This is how we can reproduce the bug:
And we get printed just
So, the second call to setIdAttribute, even with
is_id
set totrue
, revokes the identity from the attribute. The problem is withelse
branch of the source code:It removes identity, but does not check if
is_id
is0
.