Closed alvaronds closed 6 months ago
Hello,
I encountered an issue with the following code:
If I try to serializate a CarbonInterval I can without problems:
$a = new CarbonInterval(1); $b = serialize($a);
But if the CarbonInterval has been generated with diffAsCarbonInterval I get an "Serialization of 'Closure' is not allowed" error.
$a = Carbon::now(); $b = Carbon::now()->addDay(); $c = $a->diffAsCarbonInterval($b); $d = serialize($c);
I also have problems unserializing saved CarbonIntervals generated with Carbon 2 in Laravel. I need to do this to unserialize them:
str_replace('tzName','timezoneSetting',$mySavedCarbonInterval);
Carbon version: 3.3.0
PHP version: 8.3.4
I expected to get:
The serialized CarbonInterval
But I actually get:
PHP ERROR: Serialization of 'Closure' is not allowed
I tried the code in the https://play.phpsandbox.io and fails with Carbon 3. Carbon 2 works great
Thanks!
Serialization of CarbonInterval is now possible in 3.3.1.
CarbonInterval
Unserialization of Carbon v2 interval will be handled in a separated issue: #3015
Hello,
I encountered an issue with the following code:
If I try to serializate a CarbonInterval I can without problems:
But if the CarbonInterval has been generated with diffAsCarbonInterval I get an "Serialization of 'Closure' is not allowed" error.
I also have problems unserializing saved CarbonIntervals generated with Carbon 2 in Laravel. I need to do this to unserialize them:
Carbon version: 3.3.0
PHP version: 8.3.4
I expected to get:
But I actually get:
I tried the code in the https://play.phpsandbox.io and fails with Carbon 3. Carbon 2 works great
Thanks!