I have a custom controller named GetUserInfoController in GetUserInfoController.php and I have a url route rule : ‘g’ => getUserInfo/(id of action). But when visited the url my_host_name/g I receive an error of 404. I found InvalidRouteException in log of framework.
Then I read the code of framework.
I found that in function createControllerByID() of base/Module.php there is code
if (!preg_match('%^[a-z][a-z0-9\\-_]*$%', $className)) {
return null;
}
it means my controller ID ‘getUserInfo’ cannot match the regular expression ‘%^[a-z][a-z0-9\\-_]*$%’, because there a ‘U’ and ‘I’ in controller ID. It returns null, so creating controller failed.
I’m not sure is it OK? Could the regular expression be [color="#FF0000"]’%^[a-z][a-zA-Z0-9\\-_]*$%’[/color]?