[wp-trac] [WordPress Trac] #34482: wp-db.php incorrect usage of strip_invalid_text() in process_fields()

WordPress Trac noreply at wordpress.org
Fri Jan 8 12:16:11 UTC 2016


#34482: wp-db.php incorrect usage of strip_invalid_text() in process_fields()
-------------------------------+----------------------
 Reporter:  fhwebcs            |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Database           |     Version:  4.2
 Severity:  normal             |  Resolution:  invalid
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+----------------------

Comment (by TiagoGouvea):

 Cheking here, I'm passing 'NULL' on array.. but, I have a filter that fix
 it. Then, in the final query the NULL will not be a string.

 {{{#!php
 add_filter('query', 'wp_db_null_value');
 function wp_db_null_value($query)
 {
     return str_ireplace("'NULL'", "NULL", $query);
 }
 }}}

 Ok.. I'm realizing that I did so much to force the situation here.  When I
 leave the null value, null, the final query turn it to '' when updating.

 What can be a best approach to set a field to null in a generic
 wpdb->update() ?

 Thanks

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34482#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list