ZF-6893: Cannot use Zend_Application_Resource_FrontController to set baseurl for a subset of environments

Description

The baseurl for the Front Controller cannot be set using an ini file and Zend_Application_Resource_FrontController unless a baseurl is specified for all environments.

For example, we need to set the baseurl for our production environment, but not for our (multiple) development environments:

[production]
resources.frontController.baseurl = "/appname"

[development : production]
resources.frontController.baseurl = null

This works for production, but in development Zend_Application_Resource_FrontController::init() calls $front->setBaseUrl with an empty string (because Zend_Config_Ini relies on parse_ini_file which returns null and false as ""). All the checks in Zend_Controller_Front are for an actual null value and so they assume that we want a baseurl of "" rather than having no baseurl set.

I cannot think of a circumstance where we would really want baseurl="", so I suggest that we change Zend_Application_Resource_FrontController::init() to replace


                case 'baseurl':
                    $front->setBaseUrl($value);
                    break;

with


                case 'baseurl':
                    if ($value !== "") {
                        $front->setBaseUrl($value);
                    }
                    break;

Comments

Fixed in trunk and 1.9 release branch