From c7bb76e4c07189988cf297be36f0017ff33b3a56 Mon Sep 17 00:00:00 2001 From: David Matejka Date: Fri, 24 Jul 2015 22:17:52 +0200 Subject: [PATCH] Presenter: fixed signal in POST in ajax request --- src/Application/UI/Presenter.php | 3 ++- tests/Application/Presenter.parameters.phpt | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Application/UI/Presenter.php b/src/Application/UI/Presenter.php index de065d83a..24f9071ac 100644 --- a/src/Application/UI/Presenter.php +++ b/src/Application/UI/Presenter.php @@ -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]; } diff --git a/tests/Application/Presenter.parameters.phpt b/tests/Application/Presenter.parameters.phpt index e349ae917..c235feca8 100644 --- a/tests/Application/Presenter.parameters.phpt +++ b/tests/Application/Presenter.parameters.phpt @@ -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()); +});