WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#15402 closed defect (bug) (fixed)

Error suppression in wp-db is lame

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

Description

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)

comment:1 westi3 years ago

[16320] introduced this warning.

comment:2 nacin3 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.

comment:3 nacin3 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.

comment:4 nacin3 years ago

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

comment:5 nacin3 years ago

  • Keywords needs-patch added

One operator down, 19 to go. :-)

comment:6 miqrogroove3 years ago

Duplicates #11151, still on Future Release.

comment:7 miqrogroove3 years ago

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

comment:8 nacin3 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.