phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\InvalidSerializationData

Invalid serialization data

Error message

Invalid serialization data

What it means

Guard in Resultset\Complex::unserialize: after unserializing (via the 'serializer' service or native unserialize), the data is not an array, so it cannot rebuild the resultset. The input at fault is the serialized string passed to unserialize().

Solutions

  1. Validate the stored payload before unserializing; re-cache if it is corrupt or from another format.
  2. Use the same serializer for serialize/unserialize (do not mix native serialize with the custom service).
  3. Version cache keys so payloads from changed code paths are not reused.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Resultset/Complex.zep:423 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/7436bdb749347c85. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model/Resultset/Complex.zep:423

         */
        let this->disableHydration = true;

        let container = Di::getDefault();
        if container === null {
            throw new InvalidContainer();
        }

        if container->has("serializer") {
            let serializer = <SerializerInterface> container->getShared("serializer");

            serializer->unserialize(data);
            let resultset = serializer->getData();
        } else {
            let resultset = unserialize(data);
        }

        if unlikely typeof resultset != "array" {
            throw new InvalidSerializationData();
        }

        let this->rows        = resultset["rows"],
            this->count       = count(resultset["rows"]),
            this->cache       = resultset["cache"],
            this->columnTypes = resultset["columnTypes"],
            this->hydrateMode = resultset["hydrateMode"];
    }
}

View on GitHub (pinned to b7419de9cd)