ZF-9038: Last empty param is missing in params list

Description

If last param in uri is empty - http://example.com/controller/action/… getParams() or getParam() method from request class doesn't return this param (param2) and when the uri is like this: http://example.com/controller/action/… param1 is declared but empty. I've noticed it in ZF 1.9.7 but this bug also has influence on 1.10 and maybe other versions.

This problem has a source in Zend_Controller_Router_Route_Module::match() method. Match() body trims a path to clear trailing and ending self::URI_DELIMITER:


and when the uri is like this: http://example.com/controller/action/… the result is: controller/action/param1/some_value/param2
Then "for" loop determines if some value exist after param2 and because of trim it doesn't exist so the null value is assigned to param2
Unfortunately Zend_Controller_Request_Abstract::setParam() use unset for those params (whith null values):

if ((null === $value) && isset($this->_params[$key])) { unset($this->_params[$key]); } elseif (null !== $value) { $this->_params[$key] = $value; }



my suggestion is to replace code from Zend_Controller_Router_Route_Module::match():

to this one:

```

in this way the last empty param should have the same value like the empty param in the middle of path.

Comments

Fixed formatting.

I wasn't able to find any unittest that will break after this change but i don't know whether this will break backward compatibility because isset() etc. will return TRUE instead of FALSE.