Skip to content

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

Open

Description

@niden

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.

Activity

  1. self-assigned this
    on Aug 18, 2026
  2. added
    bug
    on Aug 18, 2026
  3. added theissue type on Aug 18, 2026
  4. added
    5.0
    on Aug 18, 2026
  5. moved this from Backlog to In Progress in Phalcon v5on Aug 18, 2026
  6. added and removed
    5.0
    on Aug 18, 2026
  7. added this to Phalcon v7 and removed this from Phalcon v5on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

7.0bugstatus: medium

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions