phalcon/cphalcon · error · Phalcon\Logger\Exceptions\DeserializationFailed

This object cannot be unserialized

Error message

This object cannot be unserialized

What it means

Logger adapters deliberately forbid unserialization: __unserialize() always throws to prevent constructing adapters with inconsistent internal state (resources, queues) from arbitrary payloads — also a security guard.

Solutions

  1. Do not unserialize logger adapter objects from stored data
  2. Instantiate the adapter fresh from its configuration parameters
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at phalcon/Logger/Adapter/AbstractAdapter.zep:82 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/396879b299806f69. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Logger/Adapter/AbstractAdapter.zep:82

        }

        this->close();
    }

    /**
     * Prevent serialization
     */
    public function __serialize() -> array
    {
        throw new SerializationFailed();
    }

    /**
     * Prevent unserialization
     */
    public function __unserialize(array data) -> void
    {
        throw new DeserializationFailed();
    }

    /**
     * Adds a message to the queue
     *
     * @param Item $item
     *
     * @return AdapterInterface
     */
    public function add(<Item> item) -> <AdapterInterface>
    {
        var firstKey;

        if this->queueLimit > 0 && count(this->queue) >= this->queueLimit {
            let firstKey = array_key_first(this->queue);
            if firstKey !== null {
                unset(this->queue[firstKey]);
            }

View on GitHub (pinned to b7419de9cd)