Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Regex Router does not match anything
    primarykey
    data
    text
    <p>I currently have a Zend Framework route defined as such:</p> <pre><code>$route = new Zend_Controller_Router_Route('brand/:brand_name/series/:page', array('controller' =&gt; 'brand', 'action' =&gt; 'series', 'page'=&gt;'1')); $router-&gt;addRoute('Brand Series', $route); </code></pre> <p>I'm trying to adapt this route so that the page parameter only catches numbers, so that I can add another route that uses words in the same place without the two conflicting, something like:</p> <pre><code>brand/:brand_name/series/:series_name/:page </code></pre> <p>I figured I would step along with the examples in the ZF documentation <a href="http://framework.zend.com/manual/1.11/en/zend.controller.router.html#zend.controller.router.routes.regex" rel="nofollow" title="here">here</a>. The very first step would be to change the route to something like this:</p> <pre><code>$route = new Zend_Controller_Router_Route_Regex('brand/:brand_name/series/(\d+)', array('controller' =&gt; 'brand', 'action' =&gt; 'series')); </code></pre> <p>However, this small change causes routes that matched perfectly before, like <code>/brand/johnnycupcakes/series/2</code> to fail, telling me <code>Action "johnnycupcakes" does not exist and was not trapped in __call()</code>. And in the stack trace I see:</p> <pre><code>'controller' =&gt; 'brand', 'action' =&gt; 'johnnycupcakes', 'series' =&gt; '2', 'module' =&gt; 'default' </code></pre> <p>In fact, even if I leave the route and default parameters exactly the same as in the first example, and simply change the class to Router_Route_Regex, I get the same error.</p> <p>I know that the error isn't a routing conflict, because I haven't added the route that would have conflicted. Plus, it appears that it's attempting to match to the standard route. I'm testing this on version 1.11, so my version should be perfectly compatible with the code in the example.</p> <p>As far as I can tell, the regex route is simply not matching, despite that it very clearly fits. Why could this possibly be failing?</p> <p>EDIT: I omitted the addRoute from the question the first time. I always had it in the code, that's not the issue.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload