-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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 #70153 \DateInterval incorrectly unserialized #4687
Conversation
Added a special handling for the days property, so that bool(false) is correctly converted to the proper internal representation. Solution is based on Christoph M. Becker's (https://people.php.net/cmb) patch proposed in the bug page.
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.
Thanks! I've completely forgotten this one.
@derickr Could you please check?
Using the proper accessor macro Co-Authored-By: Christoph M. Becker <cmbecker69@gmx.de>
ext/date/php_date.c
Outdated
DATE_A64I((*intobj)->diff->member, ZSTR_VAL(str)); \ | ||
} else { \ | ||
(*intobj)->diff->member = -99999; \ | ||
} \ |
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.
I think it would make more sense to treat days
separately, rather than trying to fit it into this macro (and thus giving all other properties the same behavior, even though it doesn't make sense there).
We could then also explicitly check for a false
value, rather than "" === (string)false
, as what is done now.
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.
I've created a separate macro for handling days
property.
But I'm not sure if it's the best way to solve this problem.
Added a separate macro for reading 'days' property. PHP_DATE_INTERVAL_READ_PROPERTY_I64 reverted to its original state.
Revert formatting
By the way, I have no idea why this build failed. I just started it one more time and it succeeded. There was some error with |
I assume that the test failure is intermittent, and not related to this PR. |
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.
Thanks! LGTM, but I think @derickr should have a look.
Extra whitespace removed
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 looks good to me. Thanks.
@derickr could you review it one more time, please? |
@derickr could you review it one more time, please? |
LGTM |
@derickr thank you so much! |
Thanks! Applied as d2cde0b. |
Fixes: https://bugs.php.net/bug.php?id=70153
Added a special handling for the days property, so that bool(false) is
correctly converted to the proper internal representation.
Solution is based on Christoph M. Becker's (@cmb69) patch
proposed in the bug page.