Browse Source

ZF-11393
Zend_Controller
Zend_Controller_Router_Rewrite::assemble() should throw exception when userParams is not an array


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24085 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan 14 years ago
parent
commit
206881f65f

+ 5 - 0
library/Zend/Controller/Router/Rewrite.php

@@ -450,6 +450,11 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
      */
     public function assemble($userParams, $name = null, $reset = false, $encode = true)
     {
+        if (!is_array($userParams)) {
+            require_once 'Zend/Controller/Router/Exception.php';
+            throw new Zend_Controller_Router_Exception('userParams must be an array');
+        }
+        
         if ($name == null) {
             try {
                 $name = $this->getCurrentRouteName();

+ 9 - 0
tests/Zend/Controller/Router/RewriteTest.php

@@ -756,6 +756,15 @@ class Zend_Controller_Router_RewriteTest extends PHPUnit_Framework_TestCase
             $this->_router->assemble($params)
         );
     }
+    
+    /**
+     * @group ZF-11393
+     * @expectedException Zend_Controller_Router_Exception
+     */
+    public function testCallingAssembleWithNullArgumentShouldThrowException()
+    {
+        $this->_router->assemble(null);
+    }
 }