In Linux, file names are case sensitive. From what I can tell, it appears that Yii does not handle full case-sensitivity, at least when dealing with controllers. By default the beginning char of the controller name is upper case, and the 'C' in Controller is upper case, but if camel hump notation is used in other parts of the controller name, Yii can't find the controller file. For example:
if the Controller file is named "MycustomController.php" it works just fine. However, if the controller is named "MyCustomController.php", Yii gives an error like: "Page Not Found The requested controller "mycustom" does not exist."
Does what I'm describing sound accurate (in regards to the way that Yii handles a controller w/camel hump notation)? Is there a work-around, or do I have to re-name all of my controller files?
Is there not a way to preserve case when including files? I always name my class names the same as my class files. So, for example, MyCutomClass.php contains a class definition like:
class MyCustomClass
{
...
}
Therefore, if YiiBase is attempting to include the controller file based on the class name, like include($className.'.php'), shouldn't it still work since my class name DOES use the same case and notation as the file name?
You said you have a controller file named "MyCustomController.php". Then the controller ID would be "myCustom", not "mycustom" because file name is case-sensitive on *nix.
Thanks, Qiang! Now I see. The problem is not that Yii can't find my Controller class file. The problem is that the controller and/or action ID that I used (being all lowercase) did not correspond to my actual controller and/or action name (which used camel hump notation). I had assumed that Yii treated the controller on the file system level as being case sensitive, but that the controller ID was always lowercase or case insensitive. Thanks for helping me understand how this works.
You may also take a look at CUrlManager::caseSensitive. This defaults to true, meaning Yii won't do any special processing about these IDs. If you set it to false, Yii will convert controller/action IDs to lower case before dispatching the request to a controller.
If you set caseSensitive=>false, you need to make sure your controller class is named as YiitestController (note only letter Y and C are in upper case).