Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3.0 forced uppercase naming of controllers and classes
#12

(05-18-2016, 02:41 PM)kilishan Wrote: Hey stefano, you're correct that PHP can tell what case the file system reports the file as. But the tricky part is going the other direction.

In CI 2.x, IIRC, it would first look for the file as it was asked to, whether that was "FileA", "fIlEa", "filea" or whatever, If it didn't find that version of the file, it would look again for the lowercase version. That's why your scenario worked fine in previous versions. Additionally, I believe certain file types were expected to have a different capitalization than others? Don't recall for sure, but seems to tickle my memory.

In CI3 it has standardized so that all of the files are ucfirst. This keeps things consistent among the files, and keeps it working between OSs without a hitch, while allowing the framework code to be simplified, and provide a tiny performance boost at the same time. So, if you weren't used to doing it all lower case (which I will admit, I used to like better, too), then there wouldn't be any surprises when moving from one OS to another.

Hi Kilishan, thank you for the explanation.

I still cannot understand the difference between the test I made and the "other direction", I'm sure it's something I'm missing. Do you maybe have a pointer to the source code where Codeigniter looks for the file in the capitalised version?

Another question: why couldn't CI let the route.php file decide if the controller has to be lowercase or ucfirst or whatever... for example, in my route.php file I have:

$route['default_controller'] = 'website'; //lowercase

and not:

$route['default_controller'] = 'Website'; // Ucfirst

But CI 3.0 does not complain and go searching for a "Website.php" file.

Why couldn't CI simply follow the naming used by the programmer and open the corresponding file?!

S.
Reply


Messages In This Thread
RE: Codeigniter 3.0 forced uppercase naming of controllers and classes - by stefano.corsi - 05-20-2016, 03:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB