Skip to content

Commit

Permalink
Make sure we have an array before we count()
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Feb 28, 2021
1 parent 889d09f commit 20f59d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UI/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function pagedQuery($sql, &$queryvalues, $searchfields=array(), $o
if ( $orderfields == false ) $orderfields = $searchfields;

$searchtext = '';
if ( count($searchfields) > 0 && isset($params['search_text']) ) {
if ( is_array($searchfields) && count($searchfields) > 0 && isset($params['search_text']) ) {
for($i=0; $i < count($searchfields); $i++ ) {
if ( $i > 0 ) $searchtext .= " OR ";
$searchtext .= $searchfields[$i]." LIKE :SEARCH".$i;
Expand All @@ -99,7 +99,7 @@ public static function pagedQuery($sql, &$queryvalues, $searchfields=array(), $o
if ( isset($params['desc']) && $params['desc'] == 1) {
$ordertext .= "DESC ";
}
} else if ( count($orderfields) > 0 ) {
} else if ( is_array($orderfields) && count($orderfields) > 0 ) {
$ordertext = $orderfields[0]." ";
}

Expand Down Expand Up @@ -192,7 +192,7 @@ public static function pagedHeader($rows, $searchfields=array(), $orderfields=fa
}
echo("</div>\n");
echo('<form>');
if ( $searchfields && count($searchfields) > 0 ) {
if ( is_array($searchfields) && count($searchfields) > 0 ) {
echo('<input type="text" id="paged_search_box" value="'.htmlent_utf8($search).'" name="search_text">');
Table::doForm($params,Array('search_text' => false, 'page_start' => false));
?>
Expand Down

0 comments on commit 20f59d1

Please sign in to comment.