WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4900 closed defect (bug) (invalid)

nested queries break horribly

Reported by: andy Owned by:
Milestone: Priority: highest omg bbq
Severity: critical Version:
Component: General Keywords:
Focuses: Cc:

Description

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...

Attachments (1)

nest-queries.diff (741 bytes) - added by andy 7 years ago.

Download all attachments as: .zip

Change History (3)

andy7 years ago

comment:1 andy7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

sorry, this issue belongs to hyper-db

comment:2 foolswisdom7 years ago

  • Milestone 2.3 deleted
  • Version 1.5 deleted
Note: See TracTickets for help on using tickets.