Bug: expCore:resolveFilePaths - Template locating fails when the themename occurs in the docroot path name
Reported by Martijn Bosgraaf | January 28th, 2012 @ 10:07 PM | in 2.0.5 (closed)
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.
Comments and changes to this ticket
-
expNinja January 31st, 2012 @ 08:21 PM
- State changed from new to resolved
(from [f9b6de8bb38d282416d9dde9f9ebad2cfd90744a]) Should fix a problem with old school module views when the theme name is also the name of the root folder. [#506 state:resolved] https://github.com/exponentcms/exponent-cms/commit/f9b6de8bb38d2824...
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Bug Tracker for Exponent CMS