-
Notifications
You must be signed in to change notification settings - Fork 64
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 error on PHP 8.4 #454
Fix error on PHP 8.4 #454
Conversation
d6b91c0
to
7593c47
Compare
The signature mismatch issue on PHP 8.4 is easily fixable but as seen from the failed tests the result of |
a7f078d
to
a1fcda1
Compare
The change in behavior will need to be documented in the release notes. If |
3f7a71b
to
ccfccdc
Compare
PHP 8.4 adds a new interface method DatetimeImmutable::createFromTimestamp().
{ | ||
return static::now($timezone)->setTimestamp($timestamp); | ||
$instance = PHP_VERSION_ID >= 80400 ? parent::createFromTimestamp($timestamp) : new static('@' . $timestamp); |
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.
Now that we accept float, do we need to do any special rounding/etc to mimic the 8.4 behavior when converting to a @timestamp ?
I hope not. I assume they expect the timestamp to still be an integer in float format.
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 assume they expect the timestamp to still be an integer in float format.
No, the fractional part of floats is used as microseconds https://3v4l.org/OT84B#v8.1.0
We don't have to do any additional processing.
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.
ah, ok. Wasn't sure if the @ format would throw an error, but I think that's ok if it does.
I started a draft release for 3.1 with the behavior change we've inherited from PHP. |
PHP 8.4 adds a new interface method DatetimeImmutable::createFromTimestamp().