nikic/PHP-Parser · error · \RuntimeException
Invalid position information
Error message
Invalid position information
What it means
Error "Invalid position information" thrown in nikic/PHP-Parser.
Source
Thrown at lib/PhpParser/NodeDumper.php:289
if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) {
return null;
}
$start = $node->getStartLine();
$end = $node->getEndLine();
if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos')
&& null !== $this->code
) {
$start .= ':' . $this->toColumn($this->code, $node->getStartFilePos());
$end .= ':' . $this->toColumn($this->code, $node->getEndFilePos());
}
return "[$start - $end]";
}
// Copied from Error class
private function toColumn(string $code, int $pos): int {
if ($pos > strlen($code)) {
throw new \RuntimeException('Invalid position information');
}
$lineStartPos = strrpos($code, "\n", $pos - strlen($code));
if (false === $lineStartPos) {
$lineStartPos = -1;
}
return $pos - $lineStartPos;
}
}
View on GitHub (pinned to fbd47f7ebc)
When it happens
Trigger: Thrown at lib/PhpParser/NodeDumper.php:289 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nikic/PHP-Parser@fbd47f7ebc (2026-08-17).
Data as JSON: /api/errors/f3d527b2a93ab74c.
Report an issue: GitHub.