-
-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the difference between autoescaped and escaping functions? #2411
Comments
As noted in the docblock above the properties,
|
But practically/logically that's the same thing? Can you give me an example of the difference? e.g. why is EDIT: to make it more obvious logically: printing functions => secure input only (otherwise error) => secure output Since phpcs doesn't track the type, the option: Where/how is there a difference between escaping/autoescaped functions in this schema? |
The difference is the purpose of the function. We put functionalities in the function for the sake of some intention. The same way you put similar functionalities in classes (encapsulation). The intention or purpose of escaping functions is to escape - that is, make the output safe to use. That is what they do. You pass the input in, and the output you get is safe to display. Autoescaped functions are not about escaping. For instance, the |
Seems quite arbitrary and unnecessary complex to maintain, since logically they're doing the same (even their intention might be different) in terms of secure output. |
Code is written for humans, and knowing the distinction between the two is very useful to have documented. I can tell you from first-hand experience that this list was useful when reviewing themes for instance 😉 |
It's not clear from the code nor from the docs. Could someone clarify this?
The text was updated successfully, but these errors were encountered: