-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fatal Error occurs when calling msgpack_unpack() function in PHP 7.4 or higher environment. #2299
Comments
Hello, 👋 Does the following work: $now = new DateTime('2018-06-01');
$message = @msgpack_pack($now);
$copy = msgpack_unpack($message); If it does not, then it would be way more relevant to fix the error in Else it means it impact only classes that extends Carbon/tests/Carbon/SerializationTest.php Line 54 in b5cb758
Replacing Finding what exactly msgpack is failing on here may help to get a better long-term fix. |
Hello, If it use the vanilla DateTime class instead of Carbon as suggested, it works fine. <?php
$now = new DateTime('2018-06-01');
$message = @msgpack_pack($now);
$copy = msgpack_unpack($message);
var_dump($copy);
If it call __wakeup() method directly, as in the following example, will get a Fatal error. <?php
$now = new DateTime('2018-06-01');
$now->__wakeup();
This error did not occur in 7.3 or earlier. Pecl msgpack calls __wakeup() method when msgpack_unpack() is called, as expected. |
Fix #2299 Add support for msgpack
Hello,
Fatal Error occurs when calling msgpack_unpack() function in PHP 7.4 or higher environment.
The msgpack_unpack() function can be used if pecl msgpack is enabled.
https://pecl.php.net/package/msgpack
I encountered an issue with the following code:
Carbon version: 2.46.0
PHP version: 7.4.14
pecl msgpack version:msgpack-2.1.2
https://pecl.php.net/package/msgpack
I expected to get:
But I actually get:
Thanks!
The text was updated successfully, but these errors were encountered: