PHP-021 / Advanced
Object-injection gadget chains (advanced PHP deserialization)
Why is this a problem?
Magic methods in libraries such as Monolog and Guzzle can be called in sequence, enabling file deletion or RCE. A phar:// stream can also trigger them.
How to fix it
php
$obj = json_decode(file_get_contents($uploadedPath), true, 512, JSON_THROW_ON_ERROR);
// PHP 8: block object creation with unserialize($s, ['allowed_classes' => false])