You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project that uses easypost-php. When using v6.x everything works fine, but when upgrading to v7 I ran into problems. I'm using Laravel and attempting to store the EasyPostClient in a Laravel session. Once I try to save the client to the session via middleware I'm met with the following error: Serialization of 'Closure' is not allowed. I've determined it's due to the httpClient property of the EasyPostClient object containing a closure. Under normal use this is acceptable but when the Laravel session tries to serialize the EasyPostClient object...
publicfunctionhandle($request, Closure$next)
{
// various other middleware code$client = newEasyPostClient($apiKey);
$request->session()->put('client', $client);
}
It cannot do so because that's not possible in PHP.
What was expected?
We should explore potential solutions to the problem where we can retain an instance variable of the httpClient so it's tied to the EasyPostClient so it remains performant but allows for proper serialization so users that need to pass around a client can in all situations.
Sample Code
No response
Relevant logs
No response
The text was updated successfully, but these errors were encountered:
Software Version
v7.1.0
Language Version
PHP 8.3, Laravel
Operating System
macOS
What happened?
I have a project that uses
easypost-php
. When using v6.x everything works fine, but when upgrading to v7 I ran into problems. I'm using Laravel and attempting to store theEasyPostClient
in a Laravel session. Once I try to save the client to the session via middleware I'm met with the following error:Serialization of 'Closure' is not allowed
. I've determined it's due to thehttpClient
property of theEasyPostClient
object containing a closure. Under normal use this is acceptable but when the Laravel session tries to serialize the EasyPostClient object...It cannot do so because that's not possible in PHP.
What was expected?
We should explore potential solutions to the problem where we can retain an instance variable of the httpClient so it's tied to the EasyPostClient so it remains performant but allows for proper serialization so users that need to pass around a client can in all situations.
Sample Code
No response
Relevant logs
No response
The text was updated successfully, but these errors were encountered: