Opened 9 years ago
Last modified 6 years ago
#37508 new defect (bug)
wpdb->result instance should be checked `mysqli_num_fields` in `load_col_info()`
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.9 |
| Component: | Database | Keywords: | needs-unit-tests has-patch |
| Focuses: | Cc: |
Description
In wpdb::load_col_info() the function mysqli_num_fields() is called passing $this->result without any check on this property value.
The problem is that function has a type hint to mysqli_result (see http://php.net/manual/en/mysqli-result.field-count.php), but $this->result may be false.
Just like in other places in the same class, the function should check that $this->result instanceof mysqli_result before calling mysqli_num_fields().
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Thanks for the bug report, @giuseppe.mazzapica!