Skip to content

Fix unixtojd long parameter parsing #6033

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

andypost
Copy link
Contributor

@andypost andypost commented Aug 21, 2020

Expected parameter is long but used time_t may vary depending on arch (32 or 64 bits).
Patch makes always use long (zend_long) for function argument and cast it to time_t if needed

Also it fixes test on 32-bit armv7 and x86

  • Test unixtojd() function : error conditions [ext/calendar/tests/unixtojd_error1.phpt]

Source of discussion https://gitlab.alpinelinux.org/alpine/aports/-/issues/11782#note_104912

Patch for PHP 8 a bit different and used in https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/9848

Also it fixes test on 32-bit armv7 and x86
- Test unixtojd() function : error conditions [ext/calendar/tests/unixtojd_error1.phpt]
@cmb69
Copy link
Member

cmb69 commented Aug 22, 2020

Indeed, that's a bug; I just filed https://bugs.php.net/80007. Thanks for the PR!

BTW, my assessment in 44c8b74 was wrong, since we're defining D_USE_32BIT_TIME_T; that had been corrected with 954543c.

@cmb69 cmb69 added the Bug label Aug 22, 2020
@php-pulls php-pulls closed this in b2a33ab Aug 22, 2020
@andypost
Copy link
Contributor Author

@cmb69 thanks a lot!
Now build passes fine on 32bits, except x86 still has buggy atof() but I have no patch yet https://gitlab.alpinelinux.org/alpine/aports/-/issues/11645

@cmb69
Copy link
Member

cmb69 commented Aug 22, 2020

If this is possibly a bug in PHP, please file a bug report. :)

@andypost andypost deleted the unixtojd-long-time64 branch October 21, 2022 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants