ZF-4335: Route_Regex::assemble ignoring $encode

Description

When using assemble with the regex router, parameters are not encoded when the $encode param to assemble is true. $encode is not referenced at all in assemble. I've not been able to tell if this is intentional or not, so presuming it's a bug.

Patch:

Index: library/Zend/Controller/Router/Route/Regex.php

--- library/Zend/Controller/Router/Route/Regex.php (revision 11434) +++ library/Zend/Controller/Router/Route/Regex.php (working copy) @@ -169,6 +169,12 @@ $mergedData = $this->_arrayMergeNumericKeys($mergedData, $matchedValuesMapped); $mergedData = $this->_arrayMergeNumericKeys($mergedData, $dataValuesMapped);

  • if ($encode) {
  • foreach ($mergedData as $key => &$value) {
  • $value = urlencode($value);
  • }
  • }
  •  ksort($mergedData);
    
     $return = @vsprintf($this->_reverse, $mergedData);
    

Comments

Fixed in revision 12434. ZF-4335: (felixdv) Route_Regex::assemble() is ignoring $encode.

Thanks for reporting this bug!

Changing issues in preparation for the 1.7.0 release.