How to Fix Symfony Warning: "[Debug] Class __PHP_Incomplete_Class has no unserializer

Symfony

When working with Symfony, you might see this error:

[Debug] Warning: Class __PHP_Incomplete_Class has no unserializer

This usually happens when Symfony tries to read old serialized cache data pointing to a class that no longer exists — after refactoring, moving, or deleting a class.

Warning: Class __PHP_Incomplete_Class has no unserializer

Why Does This Warning Appear?

PHP uses serialization to store objects efficiently. When a referenced class is missing during unserialization, PHP substitutes a placeholder called __PHP_Incomplete_Class, triggering a debug warning.

In Symfony, this can happen because the cache contains serialized data from old classes. Symfony’s regular cache clearing (cache:clear) may not fix it, because Symfony tries to read broken cache files during the warmup phase.

How to Fix It Properly

You must manually delete the cache files first, to prevent Symfony from trying to unserialize them:

rm -rf var/cache/*

Detailed discussion on Symfony GitHub. 👇

https://github.com/symfony/symfony/issues/20654

Get in touch 👋

Feel free to email me about anything. Want some advice? Give some feedback?

You can also reach me around the web: LinkedIn, GitHub, X (formerly Twitter)