[wp-trac] [WordPress Trac] #41450: sanitize_text_field() assumes the field is a string
WordPress Trac
noreply at wordpress.org
Thu Feb 7 22:27:44 UTC 2019
#41450: sanitize_text_field() assumes the field is a string
--------------------------+---------------------
Reporter: johnbillion | Owner: pento
Type: defect (bug) | Status: closed
Priority: low | Milestone: 5.1
Component: Formatting | Version: 2.9
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses:
--------------------------+---------------------
Comment (by Nick_theGeek):
I see this is closed and maybe I should start a new ticket for this, but
the current change is a breaking change that could potentially affect a
large number of plugins and themes. I recently ran into this with a filter
that could potentially have an integer passed to the function, which
results in an empty string being returned. This was exactly happening and
the value was being returned empty, thus an option was not updating when
expected.
I'm wondering if it might be better to check to see if the value is an
array or object and return an empty string then typecast the value to a
string. This avoids errors but also allows for expected behavior with less
breakage.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41450#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list