Cphalcon: Dispatcher's params override any setVar()

Created on 18 Oct 2017  路  1Comment  路  Source: phalcon/cphalcon

Expected and Actual Behavior

13046 introduce a fix and a breaking change: params are now send to setVars(), erasing previously set variables. Works great, but:

https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/application.zep#L351
=> injects dispatcher's params, and erase previously set variables in controllers.

Before 3.2.3

Url: /test-page/1234

$router->add('/test-page/{bar:[0-9]+}', ['controller' => 'MyController', 'action' => 'test']);

in MyController::testAction():

$this->view->setVar('bar', 'foo');

in test.volt:

{{ bar }}

Returns:

foo

After 3.2.3

Returns:

1234

Details

  • Phalcon version: 3.2.3
  • PHP Version: 7.0
  • Operating System: Linux
  • Installation type: package from packagecloud.io
  • Server: Other
bug medium

Most helpful comment

Fixed in the latest stable version. Feel free to open a new issue if the problem appears again. Thank you for contributing, and for helping us make Phalcon better.

>All comments

Fixed in the latest stable version. Feel free to open a new issue if the problem appears again. Thank you for contributing, and for helping us make Phalcon better.

Was this page helpful?
0 / 5 - 0 ratings