[wp-trac] [WordPress Trac] #62643: Prevent errors from `printf()` and `sprintf()` calls
WordPress Trac
noreply at wordpress.org
Sat Nov 1 22:52:00 UTC 2025
#62643: Prevent errors from `printf()` and `sprintf()` calls
-------------------------+------------------------------
Reporter: grapestain | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion | Focuses:
-------------------------+------------------------------
Comment (by grapestain):
I still think it would be good to change best-practice recommendations to
wrapper functions with suitable `try catch` blocks wrapping the print
functions, however combining them with the `__` function would I think
result in a function count explosion, as there is already `__`, `_x` for
context, `_e` for echo, `_n` for pluralisation, combination of these, e.g.
`_ex`, `_nx`, than there are combinations with `esc_attr` and `esc_html`,
also there are versions suffixed with `_noop`.
Making ones combined with `sprintf` and `printf` would multiply their
numbers (even if the `printf` and the `e` (echo) variants could be covered
by the same), whereas some combinations are already missing from the full
set (e.g. there is no `esc_attr_ex` and `esc_html_ex`...), so I guess more
combinations could create even more "gaps", if we already have missing
combos.
Although I agree that writing out `sprintf(__(` on a regular basis is
cumbersome...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62643#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list