[wp-trac] [WordPress Trac] #11318: $wpdb->prepare() Chokes on LIKE conditions?

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 5 15:30:23 UTC 2009


#11318: $wpdb->prepare() Chokes on LIKE conditions?
--------------------------+-------------------------------------------------
 Reporter:  miqrogroove   |        Owner:  ryan      
     Type:  defect (bug)  |       Status:  closed    
 Priority:  normal        |    Milestone:            
Component:  Database      |      Version:  2.8.4     
 Severity:  normal        |   Resolution:  worksforme
 Keywords:                |  
--------------------------+-------------------------------------------------

Comment(by miqrogroove):

 I would have liked this documented either in wp-db.php or in the codex.
 When sanitization function don't work as expected, people don't use them.

 The route I ended up taking looked something like

 "SELECT 1 WHERE" . $wpdb->prepare(" x = %s ", $var) . "AND col1 LIKE
 'image%'"

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11318#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list