[wp-trac] [WordPress Trac] #26106: Passing empty array to wpdb::update() generates invalid SQL

WordPress Trac noreply at wordpress.org
Sun Jun 15 09:08:16 UTC 2014


#26106: Passing empty array to wpdb::update() generates invalid SQL
--------------------------+------------------
 Reporter:  Viper007Bond  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.0
Component:  Database      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------

Comment (by UmeshSingla):

 Replying to [comment:2 Viper007Bond]:
 > Replying to [comment:1 nacin]:
 > > Seems dangerous to allow an unbounded UPDATE with ease. Perhaps we
 could allow for something like exactly `array( '1' => '1' )` (as in, WHERE
 1=1) as an under-the-hood, explicit way of doing an unbounded UPDATE.
 >
 > That could work, and infact that's what I tried before I realized that
 the first `1` would be treated as a column name.

 There is a workaround for 1 being treated as column name, but a query
 something like that could screw the whole database like I ended up
 corrupting my whole user meta, if no precautions are taken.

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


More information about the wp-trac mailing list