[wp-trac] [WordPress Trac] #54775: Allow int/float for esc_ functions
WordPress Trac
noreply at wordpress.org
Mon Jan 10 09:50:38 UTC 2022
#54775: Allow int/float for esc_ functions
------------------------------+-----------------------------
Reporter: malthert | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Security | Version: trunk
Severity: normal | Keywords:
Focuses: coding-standards |
------------------------------+-----------------------------
Currently e.g. esc_html only accepts strings.
Internally it casts any type to string (in wp_check_invalid_utf8)
Since phpcs WordPress is not a static analysis tool, it will report error
for required use of esc_html on int/float too.
Putting esc_html for int/float then will cause errors with static analysis
tools (psalm) however.
I think the sensible (and correct) solution would be, to change the param
and return type for esc_html and esc_attr to string|int|float
I can provide the PR if needed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54775>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list