Skip to content

[BUG]: The routing controller name changes when using syntax sugar. #15067

Closed
@fagai

Description

@fagai

Example

$eventsManager->attach(
    "dispatch:beforeDispatch",
    function(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher) {
        log($dispatcher->getControllerName());
    }
);
$router->add('hoge/huga', ['controller' => 'HogeHoge', 'action' => 'huga'];
// controller_name: HogeHoge
$router->add('hoge/huga', ['controller' => 'hoge-hoge', 'action' => 'huga'];
// controller_name: hoge-hoge

$router->add('hoge/huga', 'HogeHoge::huga'];
// controller_name: hoge_hoge

The operation is different when passing in an array and passing in a string.
Because it is uncamelize by the following process.

let routePaths["controller"] = uncamelize(realClassName);

Although it is a syntax sugar, the processing is different...

Metadata

Metadata

Labels

5.0The issues we want to solve in the 5.0 releasebreaks bcFunctionality that breaks Backwards CompatibilitybugA bug reportstatus: lowLow

Type

No type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions