-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
Description
Serializable Closure Version
2.0.3
PHP Version
8.4.4
Description
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();
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.