[#7727] Routes: Underscore between vars in URL
Summary Routes: Underscore between vars in URL
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Assigned
Priority 2. Medium
Owners mike@naberezny.com
Requester edleadesign@gmail.com
Created 2008-11-27 (3950 days ago)
Due
Updated 2010-09-24 (3284 days ago)
Assigned 2008-11-27 (3950 days ago)
Resolved
Milestone
Patch No

Comments
edleadesign@gmail.com 2008-11-27 10:52:44
when creating a route with an "_" between to variables like this:



/some/example/:myVar_:anotherVar



I get the following error



  MESSAGE: preg_match() [function.preg-match]: Compilation failed: 
syntax error in subpattern name (missing terminator) at offset 42

TYPE: Warning

FILE: /usr/local/php5/lib/php/Horde/Routes/Route.php

LINE: 612

DEBUG INFO:



607 if (substr($url, -1) == '/' && strlen($url) > 1) {

608 $url = substr($url, 0, -1);

609 }

610

611 // Match the regexps we generated

612 $match = preg_match('@' . str_replace('@', '\@', $this->regexp) . 
'@', $url, $matches);



613 if ($match == 0) {

614 return false;

615 }

616

617 $host = isset($kargs['environ']['HTTP_HOST']) ? 
$kargs['environ']['HTTP_HOST'] : null;

Chuck Hagenbuch <chuck@horde.org> 2008-11-29 01:17:02
I've verified that essentially the same regex error happens in the 
python version given the same input. I think the route might simply be 
ambiguous; if you use this as the route path, it works:



$m->connect('/some/example/:(myVar)_:(anotherVar)', array('controller' 
=> 'default'));