Opened 10 years ago
Closed 10 years ago
#30595 closed defect (bug) (duplicate)
mysqli_fetch_object is called on results from SET queries
Reported by: | thasmin | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0.1 |
Component: | Database | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
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)
Note: See
TracTickets for help on using
tickets.
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.