Issues

ZF-11769: Params passed in url do not take precedence over default param setting in route

Issue Type: Bug Created: 2011-09-26T09:42:39.000+0000 Last Updated: 2011-09-26T09:51:39.000+0000 Status: Resolved Fix version(s): Reporter: Nick M (ephialtes) Assignee: Ryan Mauger (bittarman) Tags: - Zend_Controller_Router

Related issues: Attachments:

Description

I have the following route setup here:

<pre class="highlight">
routes.blah.route = "m/c/*"
routes.blah.defaults.module = m
routes.blah.defaults.controller = c
routes.blah.defaults.action = a
routes.blah.defaults.somevar = 1

My intention is to have "somevar" as an optional parameter, where it is 1 if not specified. Going to the following url:

<pre class="highlight">
/m/c/

I can see that "somevar" is 1 as expected.

If I go to:

<pre class="highlight">
/m/c/somevar/2

I can see that "somevar" is still 1 despite me setting it in the url. The route seems fine as I can do:

<pre class="highlight">
/m/c/somethingelse/3

And "somethingelse" will be 3 as expected. Shouldn't the parameter I passed in the url take precedence over the default param value I set in the route?

My workaround at the moment is just to use a regex route to make the parameter optional but this behavior sure does seem strange.

Comments

Posted by Ryan Mauger (bittarman) on 2011-09-26T09:51:39.000+0000

Closing as not an issue, this is more of s support request.

Please use the mailing lists, or #zftalk on freenode IRC for support.

With regard to why functionally this is not an issue:

The /m/c in your route will not be parameters, but only something which would have to be matched to use that route for the request. if you wish those to be parameters, use the parameternaming to make them parameters. :m/:c/* for example.

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