Fix #70153 \DateInterval incorrectly unserialized#4687
Fix #70153 \DateInterval incorrectly unserialized#4687iakunin wants to merge 5 commits intophp:PHP-7.2from iakunin:fix-70153
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.
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.
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.
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. |
Extra whitespace removed
|
@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.