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.
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. 👇