Skip to content

Conversation

@kylekatarnls
Copy link
Contributor

@kylekatarnls kylekatarnls commented Apr 21, 2021

Here is first the test case to show the failure. Note that this passed with PHP < 8.1

See: https://bugs.php.net/bug.php?id=80974

@kylekatarnls kylekatarnls force-pushed the fix/bug80974-date-diff-timezone-gap branch from 6399f23 to 53627f9 Compare April 22, 2021 10:43
rt->h -= dst_h_corr + (two->dst - one->dst);
rt->i -= dst_m_corr;

timelib_do_rel_normalize(rt->invert ? one : two, rt);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the missing normalization would solve the test case (without breaking other ones :D )

Let me just refactor this without duplicate code and it's good to review.

@cmb69
Copy link
Member

cmb69 commented Apr 22, 2021

Thank you for the PR, but changes to date/lib should go to https://github.com/derickr/timelib. Please submit a respective PR there.

@cmb69 cmb69 closed this Apr 22, 2021
@kylekatarnls
Copy link
Contributor Author

Hello @cmb69 what about the unit test? Does not seem to be a place for them in derick/timelib.

@cmb69
Copy link
Member

cmb69 commented Apr 22, 2021

timelib has its own unit tests written in cpputest framework, so if possible you should add respective tests there. Having an additional PHPT to verify the correct behavior is certainly not a bad idea, but I'm not sure whether adding XFAIL tests is a good idea. @derickr, what do you think?

@kylekatarnls
Copy link
Contributor Author

Related timelib PR: derickr/timelib#110

@kylekatarnls
Copy link
Contributor Author

kylekatarnls commented Apr 22, 2021

I added the test in timelib. Still I think this test should be part of the php/php-src suites too to avoid any regression of this case in next versions. Don't you think so?

@cmb69
Copy link
Member

cmb69 commented Apr 22, 2021

Yes, but the test fails without the patch. Anyhow, going to reopen.

@kylekatarnls
Copy link
Contributor Author

kylekatarnls commented Jun 3, 2021

Hello @cmb69 and @derickr is there something wrong in the fix derickr/timelib#110? I'm ready to help/improve, but very please, don't release current state as is. 🙏

@cmb69
Copy link
Member

cmb69 commented Jun 3, 2021

@kylekatarnls, no worries. @derickr just told me that he needs some time to work on type 2 and comparisons, and there is plenty of time till PHP 8.1.0. :)

@nikic
Copy link
Member

nikic commented Aug 11, 2021

It looks like a fix for this issue landed with the last timelib update, and a test was added as well, so I'm closing this PR.

@nikic nikic closed this Aug 11, 2021
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.

4 participants