Configuration – Missing request_rewrite Node in Configuration

ce-1.8.1.0configuration

I'm seeing some weird behavior is a development system I upgraded from Magento CE 1.6 to Magento CE 1.8.1. Specifically, the site never gets page front controller dispatch due to the following error.

Fatal error: Call to a member function rewrite() on a non-object in /Users/alanstorm/Sites2013/magento-test-migration.dev/app/code/core/Mage/Core/Controller/Varien/Front.php on line 165

I traced this down to the following call failing to return an object.

$className = (string)Mage::getConfig()->getNode('global/request_rewrite/model');

For some reason, by global configuration does not have a request_rewrite node, even though I've cleared my cache, and this code exists on disk.

I recalls seeing similar reports in the past year since the release of 1.8.0.0. Does anyone know why this happens?

Best Answer

Self-help desk strikes again. When I un-tarred the new Magento codebase onto the old Magento codebase when updating the system, the file permissions on the

var
var/cache 

directory where changed such that my local web server couldn't write to this folder.

When this happens, Magento silently uses your computer's var and/or tmp directory space to store the cached files. Specifically, it chooses the system var dir here

#File: app/code/core/Mage/Core/Model/Config/Options.php
public function getVarDir()
{
    //$dir = $this->getDataSetDefault('var_dir', $this->getBaseDir().DS.'var');
    $dir = isset($this->_data['var_dir']) ? $this->_data['var_dir']
        : $this->_data['base_dir'] . DS . self::VAR_DIRECTORY;
    if (!$this->createDirIfNotExists($dir)) {
        $dir = $this->getSysTmpDir().DS.'magento'.DS.'var';
        if (!$this->createDirIfNotExists($dir)) {
            throw new Mage_Core_Exception('Unable to find writable var_dir');
        }
    }
    return $dir;
}

So, despite my clearing out of var/cache, Magento was still loading the cached configuration from 1.6.0.0 configuration. This version of Magento had no request_rewrite node, which is what led to the error.

Related Topic