Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15402 closed defect (bug) (fixed)

Error suppression in wp-db is lame

Reported by: westi's profile westi Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Database Keywords: needs-patch
Focuses: Cc:


WARNING: wp-includes/wp-db.php:1018 - mysql_free_result() expects parameter 1 to be resource, boolean given

This is suppressed by an @ but is probably a bug.

We should try and get rid of all the error suppressions.

Change History (8)

#1 @westi
14 years ago

[16320] introduced this warning.

#2 @nacin
14 years ago

We call wpdb::flush() immediately in wpdb::query(). That means that originally, _mysql_last_result is still null, rather than holding a resource.

#3 @nacin
14 years ago

mysql_free_result() returns true on success, false on failure, and only emits a warning if called on a non-resource. A simple is_resource() check is thus enough to remove the error suppression there, as another type of resource should never get in there.

#4 @nacin
14 years ago

(In [16321]) Only mysql_free_result if we have a valid resource, and remove error suppression there. see #15402.

#5 @nacin
14 years ago

  • Keywords needs-patch added

One operator down, 19 to go. :-)

#6 @miqrogroove
14 years ago

Duplicates #11151, still on Future Release.

#7 @miqrogroove
14 years ago

Have you seen my work on MySQL error handling in XMB?

#8 @nacin
14 years ago

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

Closing as fixed based on mysql_free_result().

Moving #11151 to 3.1 and cc'ing westi.

Have you seen my work on MySQL error handling in XMB?

Please link to that in the other ticket if you feel it's helpful.

Note: See TracTickets for help on using tickets.