mewebstudio / Purifier

HTMLPurifier for Laravel 5/6/7/8/9/10/11
MIT License
1.87k stars 230 forks source link

Automatically instantiate attributes using php class names #168

Closed mauri870 closed 2 years ago

mauri870 commented 2 years ago

Faced an issue today where attributes containing class names were not automatically instantiated when reading the config.

Example:

'attributes' => [
                ['iframe', 'allowfullscreen', 'Bool'],
                ...
                ['img', 'src', \App\Purifier\CustomAttrDef::class]
],

The following works but throws an error when running artisan config:cache since it can't serialize the object in config:

'attributes' => [
                ['iframe', 'allowfullscreen', 'Bool'],
                ...
                ['img', 'src', new \App\Purifier\CustomAttrDef()]
],