(a) On the Unix machine/platform:
(a)-(i) Install Joomla! 3.4.1
(a)-(ii) Upgrade Joomla! 3.4.1 to 3.4.2
(b) Migrate the site to a Window's machine/platform
(c) See your site in the Widow's platform and you will notice the following error
Fatal error: Class 'JClassLoader' not found in C:\wamp\www\site-name\libraries\cms.php on line 38
NO ERROR
The problem is caused by the file classloader.php located in the directory \libraries.
In Joomla! 3.4.1, this file is named ClassLoader.php (Mixed case)
In Joomla! 3.4.2, this file is named classloader.php (lowercase)
The file names being different, in a UNIX environment, after the upgrade, both the files exist and they are listed as shown below:
classloader.php
ClassLoader.php
So, when the site is brought to a Window's environment, the file classloader.php is overwritten by the file ClassLoader.php. This results in the error "Fatal error: Class 'JClassLoader' not found in C:\wamp\www\sitename\libraries\cms.php on line 38".
Note that may be irrelevant (or Food for Thought):
I also noticed a file named ClassLoader.php in the directory \libraries\vendor\composer. It is not clear whether this would result in a similar issue down the road.
@zero-24 The solution to this problem is to ensure the file with upper case characters get's removed after update in https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/script.php#L339
Additionally it would be advised to add a check to PHPCS to enforce lower case filenames at all times and prevent mixed case files from being added. The Joomla default since the development of 1.5 has always been lowercase file and folder names.
@johanjanssens
would not adding it to the script also delete classloader.php on windows systems?
@infograf768 I suspect you mean 'would adding it to the script' correct ? If so, Linux is case sensitive so there it would be removed correctly.
Windows is not case sensitive, there the file will be overridden on update. Thus, the script would only need to delete the file on Linux. This can be done in code.
Technically this issue will only problem if the Joomla site is moved from Linux to Windows after upgrade.
The solution to this problem is to ensure the file with upper case characters get's removed after update in https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_admin/script.php#L339
@johanjanssens Unfortunately this isn't as easy. On Windows (where only one file exists) JFile::delete('Foo.php')
will delete foo.php
, since Windows doesn't make a difference between the two. Which would delete our classloader and create even more troubles than we have.
On Linux this would work fine. So we need a way to find out if the OS handles filenames case sensitive or not. I'm not aware of an easy way to do this, but maybe someone knows?
My workaround would be to check the list of files in a folder and see if the filename is there twice, and then delete the CamelCased one.
Status | New | ⇒ | Confirmed |
I also noticed a file named ClassLoader.php in the directory \libraries\vendor\composer. It is not clear whether this would result in a similar issue down the road.
Nah, that's third party code and shouldn't hit the same issue. Our file was originally an extension of that class loader then changed to follow a better development practice.
Additionally it would be advised to add a check to PHPCS to enforce lower case filenames at all times and prevent mixed case files from being added. The Joomla default since the development of 1.5 has always been lowercase file and folder names.
Any examples to point to? It shouldn't be too difficult to implement if there's something to build from (admittedly I have an easier time navigating WordPress' codebase compared to the PHPCS code structure). Also, this would need to be limited in scope (basically exclude the libraries/vendor folder and any other third party code; we shouldn't be changing filenames for those things).
Just for the record I am on a CENTOS 5.11 and this file issue came up there as well, I had to rename the new (classloader.php) file to another name and then back to classloader.php to get it to work, since it still displayed it as ClassLoader.php
Just for the record I am on a CENTOS 5.11 and this file issue came up there as well, I had to rename the new (classloader.php) file to another name and then back to classloader.php to get it to work, since it still displayed it as ClassLoader.php
But there was only one file there?
Well the first time the website went down I unzipped the the Joomla_3.4.2-Stable-Full_Package.zip over all files to see if it solves the problem, hoping that any file mistakenly left our during upgrade will be updated. This worked for a few minutes, the nit went down again I then looked at the error log and found out what was really causing the problem. I then googled it and found this tread. Once I read you last replay I when over to check the file naming and there where two files. one with (naming conflict) as part of its name. The other was the old file that has not updated. I then deleted the old file, renamed the new one to the lower case and yet it still displayed as camel case a then only after renaming it to something completely other and back to classloader.php did the site start working again.
It could be the new WHM filemanger causing the renaming issue, since it is a whole new cpanel version WHM 11.50.0 (build 22)
All I wanted to point out is that the normal upgrade via com_joomlaupdate did not replace the old file of classloader.php on my CENTOS server.
Very interesting behavior which actually makes it harder to fix for us...
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-07-02 08:35:11 |
Closed_By | ⇒ | zero-24 |
In case anyone else arrives here. Other users have found that this was caused by Jotcache and resolved by updating that component.
Confirmed.
https://github.com/joomla/joomla-cms/blob/3.4.1/libraries/ClassLoader.php
https://github.com/joomla/joomla-cms/blob/3.4.2/libraries/classloader.php
@mbabker 839d2c9