Skip to content

Exception when adding ShouldQueue Listener to Event #1856

@NiroDeveloper

Description

@NiroDeveloper

If we add a ShouldQueue Listener to a event like BackupWasSuccessful it will throw a exception.
This is because laravel tries to serialize the Event, but the object contains a BackupDestination and that a Filesystem that can not be serialized.

Listener example:

class MyListener implements ShouldQueue
{
    public function handle(): void
    {

    }

}

In the service provider:
Event::listen(BackupWasSuccessful::class, MyListener::class);

It will throw a exception like this:
ERROR: Serialization of 'finfo' is not allowed {"exception":{"class":"Exception","file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Queue.php","line":160,"trace":"#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(160): serialize()

I testet this with the local and sftp filesystem driver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions