[wp-trac] [WordPress Trac] #41450: sanitize_text_field() assumes the field is a string
WordPress Trac
noreply at wordpress.org
Fri Feb 22 21:00:17 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: | Focuses:
--------------------------+---------------------
Comment (by fclaussen):
Replying to [comment:21 iCaleb]:
> I ran into the same as the above with SimpleXMLElement. It has a magic
`__toString()` method that gets called when you do that type conversion.
>
> Perhaps an extra check should be added for better backwards
compatibility?
>
> {{{#!php
> if ( ( is_object( $str ) && ! method_exists( $str, '__toString' ) ) ||
is_array( $str ) ) {
> return '';
> }
> }}}
Hi Caleb, I am cc'ed on the ticket where you saw this issue haha. The
moment I figured out what was happening I went to update the ticket and
your reply was there with the same explanation.
I like your suggestion. Should we reopen this for 5.1.1 or create a new
one?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41450#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list