Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Bug: expCore:resolveFilePaths - Template locating fails when the themename occurs in the docroot path name

#506

The issue has been verified to exist in version 2.0.2 upto and including 2.0.4

When the theme name of an Exponent installation occurs in the pathname of the docroot for the hosting environment, a failure will occur in finding the default modules-1 templates. This will result in a disfunctional CMS system.

I came across the situation when I wanted to move a website I developed to a production server. On my development server everything was just fine (as the theme name did not occur in the docroot filepath), on the production server however it failed.

An example situation:
Theme name: mycompanyname (not really uncommon)
Docroot on the server: /home/users/mycompanyname.com

The failing function:

public static function resolveFilePaths($type, $name, $subtype, $subname) {

The failing piece of code (in Exponent 2.0.4, starting at line 440 in file: framework/core/subsystems/expCore.php):

foreach($locations as $location) {
    $checkpaths[] = $location . $typepath . $relpath2;
    //if (strstr($location,DISPLAY_THEME_REAL) && strstr($relpath,"framework/modules-1")) {
    if (strstr($location,DISPLAY_THEME) && strstr($relpath,"framework/modules-1")) {
        $checkpaths[] = $location . str_replace("framework/modules-1", "modules", $relpath);
    } else {
        $checkpaths[] = $location . $relpath;
    }
    //eDebug($relpath);
}
//eDebug($checkpaths);

In above example situation you will end up with:
A PHP define DISPLAY_THEME with a value of "mycompanyname"

$locations being: Array(
    "/home/users/mycompanyname.com/framework/modules-1/views/Default.tpl",
    "/home/users/mycompanyname.com/modules/containermodule/views/Default.tpl",
    "/home/users/mycompanyname.com/themes/mycompanyname/framework/modules-1/views/Default.tpl",
    "/home/users/mycompanyname.com/themes/mycompanyname/modules/containermodule/views/Default.tpl",
}

Now this line will fail as ALL $locations will match strstr($location, DISPLAY_THEME):

if (strstr($location,DISPLAY_THEME) && strstr($relpath,"framework/modules-1")) {

Please work towards a safer way to determine if the locations need to be changed. The current solution is guaranteed to fail on more users then just me. I will for now just rename my theme to get this resolved, although it is not my preferred way to get it solved for now.

Reported by Martijn Bosgraaf · January 28th, 2012 @ 10:07 PM

State: resolved
Milestone: 2.0.5
Assigned to: dleffler dleffler

Activity

  1. expNinja
    expNinja
    • State changed from new to resolved

    January 31st, 2012 @ 08:21 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.