[wp-trac] [WordPress Trac] #4900: nested queries break horribly

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 3 21:26:00 GMT 2007


#4900: nested queries break horribly
-----------------------------+----------------------------------------------
 Reporter:  andy             |       Owner:  anonymous
     Type:  defect           |      Status:  new      
 Priority:  highest omg bbq  |   Milestone:  2.3      
Component:  General          |     Version:  1.5      
 Severity:  critical         |    Keywords:           
-----------------------------+----------------------------------------------
 This wasn't an issue before there was a 'query' filter in wpdb::query, but
 it's an issue now.

 To see what I mean, do a SELECT query while filtering a SELECT query.

 Here is what happens: Query A flushes $this->last_result. Query B flushes
 $this->last_result and then populates $this->last_result. Query A tries
 APPENDS ITS ROWS to $this->last_result. The first row returned by Query
 A's get_results or whatever is going to be the first row of Query B's
 results. Nasty!

 It's just sloppy not to initialize an array immediately prior to use, when
 that array's scope is large enough to let it be modified elsewhere.

 Patch attached. There went my weekend...

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4900>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list