phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\InvalidColumnDefinition
Invalid column definition
Error message
Invalid column definition
What it means
executeSelect() iterates intermediate['columns'] and requires each column definition to be an array produced by the parser; a non-array entry raises InvalidColumnDefinition. The faulty input is a malformed or hand-injected intermediate representation whose columns node is corrupted.
Solutions
- Let the parser generate the IR instead of passing custom arrays to setIR()
- Verify the PHQL select list uses valid column/expression syntax
- Regenerate any persisted IR that may be corrupted
Example fix
$query = (new Query('SELECT r.name FROM Robots r', $di)); // parser builds valid columns IR Defensive patterns
Strategy: type-guard
Prevention
- Use the query builder for programmatic query construction
- Avoid persisting/reusing IR across framework versions
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query.zep:1152 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/28a37701f04a388f.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Query.zep:1152
if unlikely count(connectionTypes) == 2 {
throw new MixedDatabaseSystems();
}
}
}
let columns = intermediate["columns"];
let haveObjects = false,
haveScalars = false,
isComplex = false;
// Check if the resultset have objects and how many of them have
let numberObjects = 0;
let columns1 = columns;
for column in columns {
if unlikely typeof column != "array" {
throw new InvalidColumnDefinition();
}
if column["type"] == "scalar" {
if !isset column["balias"] {
let isComplex = true;
}
let haveScalars = true;
} else {
let haveObjects = true,
numberObjects++;
}
}
// Check if the resultset to return is complex or simple
if !isComplex {
if haveObjects {
if haveScalars {View on GitHub (pinned to b7419de9cd)