Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30595 closed defect (bug) (duplicate)

mysqli_fetch_object is called on results from SET queries

Reported by: thasmin Owned by:
Priority: normal Milestone:
Component: Database Version: 4.0.1
Severity: normal Keywords:
Cc: Focuses:

Description (last modified by ocean90)

When performing a query, WordPress filters out create, alter, truncate, drop, insert, delete, update, and replace queries so they don't call mysqli_fetch_object. These queries return a boolean, not a mysqli_result object and the call to mysqli_fetch_object gives an invalid argument. Set queries need to be added to this list.

Specifically, the '/^\s*(create|alter|truncate|drop)\s/i' regular expression needs to be changed to '/^\s*(create|alter|truncate|drop|set)\s/i'. In WordPress 4.0.1, this is on line 1596 of wp-includes/wp-db.php.

Change History (2)

#1 @ocean90
12 years ago

  • Description modified (diff)

#2 @pento
12 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Duplicate of #27982.

Thanks for the bug report! This has been fixed in WordPress 4.1, by [30677].

Due to the tricky nature of matching queries, it's better to check that we have a valid result object, rather than to continue expanding that regular expression you mentioned.

Note: See TracTickets for help on using tickets.