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
The following fatal error is emitted when serializing closures created from class methods with attributes that can target only methods and not functions.
PHP Fatal error: Attribute "MyAttribute" cannot target function (allowed targets: method) in laravel-serializable-closure://#[MyAttribute()]
function (): void {
\var_dump("hello");
} on line 3
Steps To Reproduce
<?php
use Laravel\SerializableClosure\SerializableClosure;
require 'vendor/autoload.php';
class a {
public function test(): void {}
}
class b extends a {
#[\Override]
public function test(): void {
var_dump("hello");
}
}
$a = new SerializableClosure((new b)->test(...));
$a = unserialize(serialize($a));
$a();