From 705148f42da595355fd9643582b6bb5cfa071219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Tue, 21 Feb 2012 10:54:21 +0100 Subject: [PATCH] Presenter: fixed notice "array to string conversion" for PHP 5.4 --- Nette/Application/UI/Presenter.php | 8 +------- tests/Nette/Application.UI/Presenter.link().phpt | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Nette/Application/UI/Presenter.php b/Nette/Application/UI/Presenter.php index 1e55a9cccd..d34272f236 100644 --- a/Nette/Application/UI/Presenter.php +++ b/Nette/Application/UI/Presenter.php @@ -965,13 +965,7 @@ final protected function createRequest($component, $destination, array $args, $m $globalState = $this->getGlobalState($destination === 'this' ? NULL : $presenterClass); if ($current && $args) { - $tmp = $globalState + $this->params; - foreach ($args as $key => $val) { - if ((string) $val !== (isset($tmp[$key]) ? (string) $tmp[$key] : '')) { - $current = FALSE; - break; - } - } + $current = http_build_query($globalState + $this->params) === http_build_query($args); } $args += $globalState; } diff --git a/tests/Nette/Application.UI/Presenter.link().phpt b/tests/Nette/Application.UI/Presenter.link().phpt index afcd5c5aa1..ecf8b0ea98 100644 --- a/tests/Nette/Application.UI/Presenter.link().phpt +++ b/tests/Nette/Application.UI/Presenter.link().phpt @@ -122,6 +122,7 @@ class TestPresenter extends Application\UI\Presenter Assert::same( 'error: Signal must be non-empty string.', $this->link('!') ); Assert::same( '/index.php?action=default&presenter=Test', $this->link('this', array('var1' => $this->var1)) ); Assert::same( '/index.php?action=default&presenter=Test', $this->link('this!', array('var1' => $this->var1)) ); + Assert::same( '/index.php?sort%5By%5D%5Basc%5D=1&action=default&presenter=Test', $this->link('this', array('sort' => array('y' => array('asc' => TRUE)))) ); // Component link Assert::same( 'error: Signal must be non-empty string.', $this->mycontrol->link('', 0, 1) );