cphalcon: Routing is not catching named parameters correctly

I’m using the following route on Phalcon 1.3.0 and PHP 5.4.4:

    $router->addGet('/api/:controller/search/{name}',array(
        'module'=>'api',
        'controller'=>1,
        'action'=>'search',
        'namespace'=>'MyPhalconModules\Api\Controllers'
    ));

The URL I’m using is:

http://localhost/phalcon-test/api/task/search/test

In the ‘search’ action of the ‘task’ controller I do:

var_dump ($this->dispatcher->getParams());

And the output is mysteriously:

Array
(
    [name] => task
)

The expected output would be:

Array
(
    [name] => test
)

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@dugwood Quoted you in my bio on Github

At the very least you could have done what I’ve suggested… Almost everything is available to dump, which helps to detect issues. I’ve fixed some on the bugs myself for minor ones, with pull requests. Since then (was a while back ago on version 2 beta), I didn’t have any issue. And as everyone, I do it for free, because I care. So don’t say it’s impossible without even trying.