#17509·cphalcon

[BUG]: Dispatcher::forward fails loud on non-string values

Author: nidenCreated Aug 18, 2026Updated Aug 18, 2026
Labelsbugstatus: medium7.0

Problem

AbstractDispatcher::forward() moves four keys out of the $forward array. Three of them land in string-typed properties:

key property type
namespace $namespaceName string
controller $handlerName string
task $handlerName string
action $actionName string

The values are assigned with no type check, so a caller passing anything other than a string gets a raw TypeError from the property assignment:

TypeError: Cannot assign int to property
Phalcon\Dispatcher\AbstractDispatcher::$namespaceName of type string

It does fail, but the message points at an internal property rather than at the key the caller got wrong, and it surfaces at the assignment rather than at the call. The goal is a domain exception that names the offending key.

This is a deliberate divergence from cphalcon. Zephir's property type annotations are not enforced, so forward(["namespace" => 1234]) stores the integer silently there. We prefer to fail loud. See "Sync".

Why this is not covered today

forward() guards each key with isset(), which mirrors the Zephir fetch and already skips nulls. Only a non-null, non-string value reaches the assignment, and nothing in the suite does that.