-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
using printf/sprintf in some cases makes escaping less than ideal #556
Comments
WordPress allows HTML in term descriptions, so it's not advisable to escape them. It's debatable if switching in and out of PHP really increases readability, but we recently reduced the use of |
This ticket was inspired based on feedback I received on an ongoing VIP project and based on escaping all the things. If esc_html is incorrect it should still be escaped:
It is debatable that going in and out of php is more readable. It is my opinion that it is more readable. You have in the _sposted_on() example you still have three nested sprintf functions that are stored to a variable and passed into another (inception). For people using this as a starter theme, they'll most likely need to change some part of the output, it does become confusing. What is the argument against going in and out of php? There are many instances where _s goes in and out of php for readability. |
Now uses the new archive template tags and makes archive template titling way simpler! Added shims for backwards compatibility, which can be removed once WordPress 4.3 was released. See https://core.trac.wordpress.org/changeset/30223 Closes Automattic#556.
There are a few areas of _s that use sprintf/printf that obfuscate readability and make it harder to escape as late as possible.
This is a simple example but _s_posted_on() is kind of a nightmare to read.
The text was updated successfully, but these errors were encountered: