?
avatar scipiojr
scipiojr
26 Jul 2015

Steps to reproduce the issue

  1. Install Joomla on a webspace where html_public folder is named "html". There are some shared hosters, even those who claim their hosting packages "Joomla ready"
  2. Try to create an layout override for any module/component/layout

Expected result

Successful copy attempt.

Actual result

Copy attempt failes with a list of warnings and an COM_TEMPLATES_OVERRIDE_FAILED error

JFile: :copy(/html/components/[...].php, /html/templates/[...].php): copy(/html//templates/[...].php): failed to open stream: No such file or directory

Please note the double slash between "html" and "templates" on the "output" side.

System information (as much as possible)

Einstellung Wert
PHP erstellt für Linux s1051 2.6.32.63-kvm-32cpu-04 #4 SMP Mon Oct 6 11:56:55 CEST 2014 x86_64
Datenbankversion 5.6.20
Datenbankzeichensatz utf8_general_ci
PHP-Version 5.6.2
Webserver Apache
PHP-Interface für den Webserver cgi-fcgi
Joomla!-Version Joomla! 3.4.3 Stable [ Ember ] 2-July-2015 16:00 GMT
Joomla!-Plattform-Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Browsererkennung Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0

Additional comments

JStream::_getFilename (line 1391 and str_1401) does a simple str_replace on $filename to eliminate JPATH_ROOT thus removing all parts of $filename which resemble JPATH_ROOT.

$filename = str_replace(JPATH_ROOT, '', $filename);

should be replaced with something like this:

$pos = strpos($filename, JPATH_ROOT);
if ($pos !== false) {
   $filename = substr_replace($filename, '', $pos, strlen(JPATH_ROOT));
}

so that only the first occurrence gets replaced. This error probably affects any file system operation such as module updates, too.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar scipiojr scipiojr - open - 26 Jul 2015
avatar Achal-Aggarwal
Achal-Aggarwal - comment - 27 Jul 2015

I confirmed this issue by writing a unit test.

Proposed fix fixes the problem. Checkout following url for reference
https://github.com/joomla-framework/filesystem/pull/14/files


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7558.

avatar brianteeman
brianteeman - comment - 29 Jul 2015

As we have a fix created for the upstream library I am going to close this here.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7558.

avatar brianteeman brianteeman - change - 29 Jul 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-07-29 08:34:27
Closed_By brianteeman
avatar brianteeman brianteeman - close - 29 Jul 2015

Add a Comment

Login with GitHub to post a comment