Zend Framework

Cannot use Zend_Application_Resource_FrontController to set baseurl for a subset of environments

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.2
  • Component/s: Zend_Application
  • Labels:
    None

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;

Activity

Hide
Matthew Weier O'Phinney added a comment -

Fixed in trunk and 1.9 release branch

Show
Matthew Weier O'Phinney added a comment - Fixed in trunk and 1.9 release branch

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: