CodeIgniter Forums
Problem with case sensitive in loading controllers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Problem with case sensitive in loading controllers (/showthread.php?tid=62099)

Pages: 1 2


Problem with case sensitive in loading controllers - shajamansoor - 06-09-2015

I am using Codeigniter 3.0

I am experiencing some strange behaviour in codeignitor.

i have two methods in my Profile controller, an index() and a user().

When i visit localhost/profile/ I get the index as expected.

When i visit localhost/profile/user/… i get a 404. However if i capitilize the controller name to localhost/Profile/user/… then i see my user method.

If i change the class name to lowercase in the controller then my index method will not load up either.

Anybody have any ideas?

Thanks in advance


RE: Problem with case sensitive in loading controllers - Avenirer - 06-09-2015

Is your controller file name profile.php. It should be Profile.php.


RE: Problem with case sensitive in loading controllers - shajamansoor - 06-09-2015

i am using codeigniter 3.0

i am used to access method like localhost/Profile/user/ its working perfectly, but i need to use url like localhost/profile/user/

my controller name is Profile.php and class name Profile.

how can i use url like localhost/profile/user/


RE: Problem with case sensitive in loading controllers - InsiteFX - 06-09-2015

This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.


RE: Problem with case sensitive in loading controllers - Narf - 06-10-2015

(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.


RE: Problem with case sensitive in loading controllers - InsiteFX - 06-10-2015

(06-10-2015, 01:34 AM)Narf Wrote:
(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.


@Narf

I have had to work on some client sites where the file names had to be all lower case or the site would not see the file name.

My web site does not care the case even on directories.


RE: Problem with case sensitive in loading controllers - Narf - 06-10-2015

(06-10-2015, 03:45 AM)InsiteFX Wrote:
(06-10-2015, 01:34 AM)Narf Wrote:
(06-09-2015, 10:59 PM)InsiteFX Wrote: This is going to be a problem, CI should not care about the file name case but the class name case, almost all web hosting providers that run Linux servers require lower case file names.

Actually, CI cares about filename casing ... class names in PHP are not case-sensitive, no matter what OS it runs on.

Also, this is the first time I hear about a hosting provider requiring all-lower-case filenames, that's just batshit insane. I suspect some custom routes are the problem here.


@Narf

I have had to work on some client sites where the file names had to be all lower case or the site would not see the file name.

My web site does not care the case even on directories.

CI2 may want you to have some files in lower-case in some cases; CI3 requires class file names to be in Ucfirst. The hosting provider doesn't have control over this and even if it did - it would make no sense.

If it doesn't make a difference, then you're just running on a case-insensitive file system. That's the case on Windows, case-insensitive OSX (configurable during OS setup IIRC) or some weird Linux box that actually uses NTFS or something.


RE: Problem with case sensitive in loading controllers - mwhitney - 06-10-2015

OS X and Linux case sensitivity are based on the file system, and configurable when defining/formatting the partition on the drive (if the file system itself supports case-insensitivity, since most do not).

Some FTP clients include an option to convert the filenames to lowercase. It may be the case that some hosting providers have a web-based file uploader which automatically converts filenames to lowercase as well.

As Narf already said, converting the filenames to lowercase is crazy, and I would put it at a level only slightly crazier than case-insensitive filesystems.


RE: Problem with case sensitive in loading controllers - no1youknowz - 06-11-2015

I have about 100+ controllers, 80+ models and 50+ libraries and probably well over 150+ views. A crazy crazy enterprise platform. I upgraded from CI 2 to CI 3.

There was no way lol, that I was going to change all the filenames from lowercase to uppercase. Nope, don't have the time for that silly stuff.

You can change codeigniter 3 to revert back to lowercase. Of course and before anyone jumps down my throat, 1) you have to know what you are doing and 2) you better know how to maintain your installation should any problems occur and 3) don't forget to change for future versions.

The changes I made work well, haven't had a single issue and the application runs like CI 2.0.

So yeah, you can side-step any issue here. You just gotta know the framework code.


RE: Problem with case sensitive in loading controllers - mwhitney - 06-11-2015

I modified my (already extended) loader to load files using either lowercase or ucfirst, but I still took the time to change my filenames (because, at some point, I'm going to remove the code which checks for the lowercase filename). I ended up changing the names of a little over 400 files, but they never would have had the previous filenames if it hadn't been for CI2's filename requirements. I may still have some issues with the way CI handles class/file names, but getting rid of the all-lowercase file names is not one of them.