"Search Networks" is broken
Created by: cfoellmann
I know the search for WP_List_Table is bad but this one is broken. Following issues:
-
ALL search terms, but
*
(all networks are correctly displayed), result in No networks found. - the ID of an existing network results in No networks found. BUT shows 1 item for the table
Imported comments:
By kaichi on 2014-12-18 08:03:55 UTC
I just noticed in class-wp-ms-networks-list-table.php on line 41 uses like_escape and according to Codex it has deprecated in 4.0, suggests using $wpdb->esc_like()
By cfoellmann on 2014-12-18 08:14:31 UTC
It's unrelated. There is a closed PR for this here but it would increase the required WP version to 4.0 which is not really feasible.
By rmccue on 2014-12-18 10:54:50 UTC
There is a closed PR for this here but it would increase the required WP version to 4.0 which is not really feasible.
Could not we not use if (function_exists(array($wpdb, 'esc_like'))) $wpdb->esc_like(...); else like_escape(...)
? (Obviously in a wrapper function)
By kaichi on 2014-12-29 07:37:12 UTC
A few things from what I've been tinkering with,
What if $query lines 45 to 57 is not playing well -or- perhaps a SQL syntax error in the additional $query $search_conditions on line 60 to 85
Like @cfoellmann described, querying with site_id will show count for $total_query but when $query gets plugged into line 118 $wpdb->get_results return an empty array!
If you query a domain, we get nothing back from $total_query and an empty array is returned on line 118.
If you look at lines 69 - 72 this does not handle domains to well, $total_query and $query return nothing. If you comment out 69 and 70 then on line 71 and 72 replace $blog_s to $like_s you will notice that $total_query will count the matches, mydomain.com will count 1; myseconddomain.com count 1. $query still returns a blank array on line 118
I am reading the entire SQL query in my head; both as a numeric and string but I cannot for the life of me figure out why line 118 is returning a blank array. Is $wpdb blocking the query????
$this->items = $wpdb->get_results( $query, ARRAY_A );
Sorry if my regurgitated text is confusing I'm new to this.