Opened 16 years ago
Closed 15 years ago
#10536 closed defect (bug) (worksforme)
errors surfacing when using set_error_handler
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Warnings/Notices | Keywords: | reporter-feedback close |
Focuses: | Cc: |
Description
So, I've been getting some strange errors surfacing while developing a plugin. Three errors along the lines of "mysql_free_result(): supplied argument is not a valid MySQL result resource."
They seem to be normally suppressed, but surface when using set_error_handler(), and only when trying to create a table. It appears that in "wp-includes/wp-db.php" that the result of the query isn't being checked before being passed to the MySQL functions.
Attachments (1)
Change History (8)
#2
@
16 years ago
- Milestone changed from Unassigned to 2.9
- Owner set to westi
- Status changed from new to reviewing
#4
@
16 years ago
- Keywords reporter-feedback added; has-patch removed
Looking at the code in $wpdb
and php docs we should only every get false returned from mysql_query
if there is an error.
In this case this code will mean we never reach the branch the patch changes:
if ( $this->last_error = mysql_error($this->dbh) ) { $this->print_error(); return false; }
Do you know what the query was that produced this notice?
#5
@
16 years ago
- Keywords close added
might be this:
http://www.php.net/manual/en/function.mysql-error.php#12831
some error can't handle. Example:
ERROR 1044: Access denied for user: 'ituser@…' to database 'itcom'
This error ocurrs when a intent of a sql insert of no authorized user. The results: mysql_errno = 0 and the mysql_error = "" .
seems quite rare, though. wontfix?
#6
@
15 years ago
Which lines you get the error from? can you provide your set_error_handler() routine? Those callback will reveal notices / errors even the @ operator is in use.
It might be possible to flag those cases out by configuring the callback / validating against a callbacks parameter value. That might depend on your PHP version you use on your blog.
To learn more about set_error_handler() please see the PHP documentation.
Until no more details are provided in the bug reprot I suggest to close as wontfix unless more concrete information is provided.
check if the result is valid for passing to mysql_fetch_field(), etc.