ZF-7994: Zend_Controller_Router_Route does not work with URL view helper if passing in an array of values

Issue Type: Bug Created: 2009-09-30T19:01:52.000+0000 Last Updated: 2011-04-11T09:11:20.000+0000 Status: Open Fix version(s): Reporter: Adam George (asgeo1) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: - ZF-9706



I am creating a URL like so:

<pre class="highlight">
    $this->view->url(array('sort' => array('param1','param2'));

Notice the array of params for 'sort'. This works fine when I am using the standard router. If I use my own router, I always get an error:

<pre class="highlight">
    $router->addRoute('controlleralias', new Zend_Controller_Router_Route(
            'module'     => 'mymodule',
            'controller' => 'mycontroller',
            'action'     => 'myaction'

<pre class="highlight">
    urlencode() expects parameter 1 to be string, array given

    #0 [internal function]: __lambda_func(Array)
    #1 /library/Zend/Controller/Router/Route.php(398): urlencode(Array, false, true)
    #2 /library/Zend/Controller/Router/Rewrite.php(441):     Zend_Controller_Router_Route->assemble(Array, NULL, false, true)
    #3 /library/Zend/View/Helper/Url.php(49): Zend_Controller_Router_Rewrite->assemble(Array)

If I do NOT use an array of params, my custom router works fine:

<pre class="highlight">
    $this->view->url(array('sort' => 'param1'));

I have concluded that this is a bug in Zend_Controller_Router_Route, that it does not support arrays being used as values when assembling the URLs.


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.