Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error serialised with php8. 4 Hooks #57357

Open
Open
@Fulliton

Description

Laravel Version

12.32.5

PHP Version

8.4

Database Driver & Version

Mariadb 11, redis latest

Description

There is a bug in Laravel

If new get-set Hooks are used in the model, an error pops up when executing queues or Events using redis.

I use this bug fix in my work projects. The solution to get away from Attributes is to get away from using magic methods for simple calculations.

Error message: "Failed to serialize job of type [Illuminate\Events\CallQueuedListener]: serialize(): "full_name" returned as member variable from __sleep() but does not exist"

Code in Model

<?php
namespace App\Models;
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
final class Client extends Authenticatable
{
 use HasApiTokens;
 use HasFactory;
 use Notifiable;
 use Prunable;
 use SoftDeletes;
 protected $connection = 'mariadb';
 protected $fillable = [
 'first_name',
 'last_name',
 'middle_name',
 ];
 public string $full_name {
 get => "{$this->last_name}{$this->first_name}{$this->middle_name}";
 }
 ...
 
}

I'm using this fix in Laravel version 12.32.5.

Wtf @taylorotwell ???

Pls view commit Fulliton@95d7bc1

Steps To Reproduce

Fulliton@95d7bc1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /