Ticket #10607 (closed defect (bug): fixed)
return variable $new_array in wp-includes/wp-db.php is not initialized
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Warnings/Notices | Version: | 2.8.3 |
| Severity: | normal | Keywords: | dev-feedback |
| Cc: |
Description
Concerns "function get_results($query = null, $output = OBJECT)".
If the query is valid, but the result is empty the "return $new_array" $new_array is uninitialized.
You can see this, if you enable "error_reporting(E_ALL)".
"$new_array = array();" at the begin of the function will solve the error.
Attachments
Change History
comment:1
miqrogroove — 2 years ago
- Keywords needs-patch added; variable initialization removed
- Owner set to westi
- Component changed from General to Warnings/Notices
- Milestone changed from Unassigned to 3.0
- Status changed from new to closed
- Resolution set to fixed
- Status changed from accepted to closed
- Resolution set to fixed
- Keywords dev-feedback added; needs-patch removed
During the dev chat today, it was brought up that is_null($result) could pose a problem for plugins as a result of [13671].
Checking for is_array() or !is_array() for whether there are or are not results is a similar situation. I made one fix in [13681].
While I doubt we do this elsewhere in core, I wanted to re-open for discussion, as this could definitely break some plugins and I'm not sure there's a good solution;.
comment:10
nacin — 22 months ago
- Status changed from reopened to closed
- Resolution set to fixed
Per IRC discussion.


+1 Also, put eyeballs on get_col_info()