Change to wpdb::get_col() breaks documented behavior
|Reported by:||mdawaffe||Owned by:||anonymous|
According to the documentation, get_col() should be able to be called with an empty argument in the following situation.
$a = get_col( "SELECT a, b FROM table" ); $b = get_col( '', 1 );
This is almost never needed since get_results() is almost always more efficient for grabbing data from multiple columns. Very ocassionally, this use of get_col() is more efficient and should still be supported. Otherwise, it will be necessary to write a wrapper function around get_results() to achieve the same thing. Since core WP does not make use of this type of call to get_col(), any plugin that does will have to write their own wrapper functions for the few cases where the old get_col() is more efficient than get_results().
I cannot think of when it would be useful for get_row() or get_results() to act in the old manner. It's only in the transformation of the data from row-centric to column-centric that this issue occurs.
Attached is a patch that reverts get_col() and fixes a PHP warning.