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've been investigating an issue with queue serialization in Laravel and I'm trying to determine if it's a Laravel bug or truly how Laravel implements queue deserialization.
// MyJobClass.phppublicfunction__construct(
public ?Carbon$date = null,
) {
// dd($date); is a new carbon object?
}
When the job is scheduled via the console, $date is a new Carbon instance of today, However, if I fire the job manually (sync or non-console with no arguments), the expected null is passed.
It seems something in the job deserialization process during scheduling is instantiating a new Carbon object. I moved the logic to the handle() method as a workaround, but I'm curious—what quirks in queue serialization might be causing this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been investigating an issue with queue serialization in Laravel and I'm trying to determine if it's a Laravel bug or truly how Laravel implements queue deserialization.
Laravel 11.34.2
PHP 8.3
In my console scheduler, I have:
Now, in my job:
When the job is scheduled via the console,
$date
is a new Carbon instance of today, However, if I fire the job manually (sync or non-console with no arguments), the expectednull
is passed.It seems something in the job deserialization process during scheduling is instantiating a new Carbon object. I moved the logic to the
handle()
method as a workaround, but I'm curious—what quirks in queue serialization might be causing this?Beta Was this translation helpful? Give feedback.
All reactions