Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T15603 Fix dispatcher setParams during dispatch loop #15794

Merged
merged 3 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- `Phalcon\Translate\Adapter\NativeArray::has()` [#15785](https://github.com/phalcon/cphalcon/issues/15785)

## Fixed
- Fixed `Phalcon\Dispatcher\Dispatcher::setParams()` not updating local params during `dispatch()` loop [#15603](https://github.com/phalcon/cphalcon/issues/15603)

# [5.0.0alpha7](https://github.com/phalcon/cphalcon/releases/tag/v5.0.0alpha7) (2021-11-16)

Expand Down
11 changes: 5 additions & 6 deletions phalcon/Dispatcher/AbstractDispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements Disp
bool hasService, hasEventsManager;
int numberDispatches;
var value, handler, container, namespaceName, handlerName, actionName,
params, eventsManager, handlerClass, status, actionMethod,
eventsManager, handlerClass, status, actionMethod,
modelBinder, bindCacheKey, isNewHandler, handlerHash, e;

let container = <DiInterface> this->container;
Expand Down Expand Up @@ -332,12 +332,11 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements Disp
let namespaceName = this->namespaceName;
let handlerName = this->handlerName;
let actionName = this->actionName;
let params = this->params;

/**
* Check if the params is an array
*/
if unlikely typeof params != "array" {
if unlikely typeof this->params != "array" {
/**
* An invalid parameter variable was passed throw an exception
*/
Expand Down Expand Up @@ -498,9 +497,9 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements Disp
let modelBinder = this->modelBinder;
let bindCacheKey = "_PHMB_" . handlerClass . "_" . actionMethod;

let params = modelBinder->bindToHandler(
let this->params = modelBinder->bindToHandler(
handler,
params,
this->params,
bindCacheKey,
actionMethod
);
Expand Down Expand Up @@ -550,7 +549,7 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements Disp
let this->returnedValue = this->callActionMethod(
handler,
actionMethod,
params
this->params
);

if this->finished === false {
Expand Down