Skip to content

Commit

Permalink
Presenter: fixed signal in POST in ajax request
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 authored and dg committed Aug 13, 2015
1 parent 1e947c7 commit c7bb76e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Application/UI/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@ private function initGlobalParameters()
$params = $this->request->getParameters();
if ($this->isAjax()) {
$params += $this->request->getPost();
} elseif (isset($this->request->post[self::SIGNAL_KEY])) {
}
if (isset($this->request->post[self::SIGNAL_KEY])) {
$params[self::SIGNAL_KEY] = $this->request->post[self::SIGNAL_KEY];
}

Expand Down
10 changes: 10 additions & 0 deletions tests/Application/Presenter.parameters.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,13 @@ test(function () {
)));
Assert::same(array('', 'foo'), $presenter->getSignal());
});

test(function () {
//AJAX: signal in POST overwriting empty GET
$presenter = createPresenter();
$presenter->ajax = TRUE;
$presenter->run(new Application\Request('Foo', 'POST', array('do' => NULL), array(
'do' => 'foo'
)));
Assert::same(array('', 'foo'), $presenter->getSignal());
});

0 comments on commit c7bb76e

Please sign in to comment.