Opened 10 years ago
Last modified 7 years ago
#37508 new defect (bug)
wpdb->result instance should be checked `mysqli_num_fields` in `load_col_info()`
| Reported by: | giuseppe.mazzapica | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Database | Version: | 3.9 |
| Severity: | normal | Keywords: | needs-unit-tests has-patch |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks for the bug report, @giuseppe.mazzapica!