?
avatar imanickam
imanickam
1 Jul 2015

Steps to reproduce the issue

(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

Expected result

NO ERROR

Actual result

System information (as much as possible)

Additional comments

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.

Votes

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

avatar imanickam imanickam - open - 1 Jul 2015
avatar imanickam imanickam - change - 1 Jul 2015
The description was changed
avatar johanjanssens
johanjanssens - comment - 1 Jul 2015

@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.

avatar infograf768
infograf768 - comment - 1 Jul 2015

@johanjanssens
would not adding it to the script also delete classloader.php on windows systems?

avatar johanjanssens
johanjanssens - comment - 1 Jul 2015

@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.

avatar Bakual
Bakual - comment - 1 Jul 2015

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.

avatar zero-24 zero-24 - change - 1 Jul 2015
Status New Confirmed
avatar johanjanssens
johanjanssens - comment - 1 Jul 2015

@Bakual True. Counting the files would be sufficient indeed, if two files are found you can assume the file system is case sensitive and remove the file with the CamelCase.

avatar mbabker
mbabker - comment - 1 Jul 2015

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).

avatar Llewellynvdm
Llewellynvdm - comment - 1 Jul 2015

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


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

avatar Bakual
Bakual - comment - 1 Jul 2015

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?

avatar Llewellynvdm
Llewellynvdm - comment - 1 Jul 2015

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.

avatar Bakual
Bakual - comment - 1 Jul 2015

Very interesting behavior which actually makes it harder to fix for us...

avatar Bakual
Bakual - comment - 1 Jul 2015

Can you try and review #7307?

avatar johanjanssens
johanjanssens - comment - 1 Jul 2015

@Bakual Moving to file into /libraries/cms to allow it to be autoloaded is very good fix for this. Problem solved and one require less in the code. Nice one.

avatar zero-24
zero-24 - comment - 2 Jul 2015

Closing as #7307 gets merged for 3.4.3 :smile:

avatar zero-24 zero-24 - change - 2 Jul 2015
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2015-07-02 08:35:11
Closed_By zero-24
avatar zero-24 zero-24 - close - 2 Jul 2015
avatar uglyeoin
uglyeoin - comment - 26 Jan 2018

In case anyone else arrives here. Other users have found that this was caused by Jotcache and resolved by updating that component.

Add a Comment

Login with GitHub to post a comment