Skip to content

"PHP Warning: Class __PHP_Incomplete_Class has no unserializer" when a class that was serialized with a custom handler no longer exists #18128

Closed as not planned
@MatmaRex

Description

@MatmaRex

Description

A warning "PHP Warning: Class __PHP_Incomplete_Class has no unserializer" is emitted when a class that was serialized with a custom handler (instanceof Serializable / 'C' format) no longer exists.

This is unexpected to me, because the real problem is that the class does not exist at all, not that it has no unserializer. There's no warning for that though, the user is expected to check for instances of __PHP_Incomplete_Class.

The following code:

<?php
unserialize('C:3:"obj":23:{s:15:"My private data";}');    

Resulted in this output:

PHP Warning:  Class __PHP_Incomplete_Class has no unserializer in php shell code on line 1

But I expected this output instead:

(no warnings)

PHP Version

PHP 8.3.6

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions