Issues

ZF-9706: Zend_Controller_Router_Route don't handle array parameters with wildcard routes

Issue Type: Bug Created: 2010-04-19T00:51:18.000+0000 Last Updated: 2011-04-20T12:06:34.000+0000 Status: Open Fix version(s): Reporter: Sasa Stamenkovic (umpirsky) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: - ZF-7994

Attachments: - Zend_Controller_Router_Route.diff

Description

To reproduce this isuue, make route like this

resources.router.routes.cars.route = "auto-oglasi/*" resources.router.routes.cars.defaults.module = "default" resources.router.routes.cars.defaults.controller = "auto-oglasi" resources.router.routes.cars.defaults.action = "index"

This works as expected, unless you work with array notation URLs, like /auto-oglasi/price/0/price/1000/year/1984/year/2010 In such case parameters become strings, instead arrayas, so price will have value "0", year "1984", etc..

I think this is a bug in Zend_Controller_Router_Route, because it treats parameters as strings, and get only first value, ignoring others

                    if (!isset($this->_wildcardData[$var]) && !isset($this->_defaults[$var]) && !isset($values[$var])) {
                        $this->_wildcardData[$var] = (isset($path[$i+1])) ? urldecode($path[$i+1]) : null;

}

Comments

Posted by Sasa Stamenkovic (umpirsky) on 2010-04-19T00:54:33.000+0000

Here is a fix suggestion, it would be nice to have this resolved in current bug hunt days ;)

Posted by Jonny White (jonny-white) on 2011-04-20T12:06:34.000+0000

The Suggested diff got me part way there on this one but didn't work for anything more than 2 items in the array. I've changed one line which seems to work very well. http://pastie.org/1815135

Have you found an issue?

See the Overview section for more details.

Copyright

© 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.

Contacts