[wp-trac] [WordPress Trac] #34482: wp-db.php incorrect usage of strip_invalid_text() in process_fields()
WordPress Trac
noreply at wordpress.org
Thu Oct 29 12:43:44 UTC 2015
#34482: wp-db.php incorrect usage of strip_invalid_text() in process_fields()
--------------------------+-----------------------------
Reporter: fhwebcs | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Using $wpdb->update I'm stumbling upon errors while updating multiple
fields.
Source: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
db.php#L2083
In my opinion the result of strip_invalid_text() within process_fields()
is used incorrectly:
{{{
$converted_data = $this->strip_invalid_text( $data );
if ( $data !== $converted_data ) {
return false;
}
}}}
Comparing $data (multiple nested array) with returned value
(array|WP_Error) from `strip_invalid_text()` makes no sense. So, it should
be replaced by:
{{{
$data = $this->strip_invalid_text( $data );
if ( is_wp_error( $data ) ) {
return false;
}
}}}
For another example see usage of `$this->strip_invalid_text()` in
`strip_invalid_text_from_query()`
(https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
db.php#L2887)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34482>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list