Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Dispatcher tries to camel case twice #12829
Expected and Actual Behavior
The following line in the Dispatcher can cause the controller name to be incorrectly camel cased two times, which can cause routes to not work:
For single word controllers (e.g.
The problem arises when routes are defined in either of the following formats:
IMO, the real problem is that Phalcon Router class is trying to be too accommodating and allowing the controller to be passed in as
To solve the problem, without a change being made to Phalcon, I could have done 1 of 2 things.
The first thing was to change the controller names to be snake_case. Example:
I decided against this approach because engineers wouldn't be able to simply search across the code base for all uses of
The second option was to override the default Dispatcher behavior. This was the approach I took for now until this issue can be discussed and resolved:
I will create another story for documentation too, since I feel like the following page should showcase more examples with multiple word controller/action names:
I think the documentation and code should be explicit and enforce a certain way. Ideally the way we pass in controller and action names would be similar.
Another side note, which is important for reproducing. This bug only appears if your source code is on a case-sensitive operating system (e.g. linux). It will not appear on mac, or if your code is mounted to a mac OS, because mac treats the following the same:
This is the same issue I faced trying to camelize the action name, in my last PR.
I noticed where Zephir's