[wp-trac] [WordPress Trac] #45299: `wpdb->last_result` may not be countable

WordPress Trac noreply at wordpress.org
Mon Nov 12 21:28:38 UTC 2018


#45299: `wpdb->last_result` may not be countable
-------------------------------+---------------------
 Reporter:  desrosj            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  5.0
Component:  Query              |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  php73 needs-patch  |     Focuses:
-------------------------------+---------------------

Comment (by spacedmonkey):

 For a bit more detail, this notice error is generated when an invalid or
 empty query is passed to the `get_col`. It is kind of edge case but not to
 replicate.

 The issue, is because `get_row` can return a `last_result` as null.
 There are two fixes for this, either we change `get_row`, so it returns an
 empty array on failure. But this could be a breaking change as it changes
 functionality.

 I have patched a patch for a much similar solution, that doesn't even
 require is_countable to be called.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45299#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list