Skip to content

Commit

Permalink
page: fix PHP 8 compatibility issues
Browse files Browse the repository at this point in the history
- passing null to ReflectionClass::hasMethod() is deprecated
- passing null as $haystack to strpos() is deprecated
  • Loading branch information
gerryd committed Mar 18, 2023
1 parent 945c635 commit 000419d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Skeleton/Pager/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function get_paged($sort = null, $direction = 'asc', $page = 1, $e
$object = new \ReflectionClass(get_class());
if (is_callable($sort)) {
$sorter = 'object';
} elseif ($object->hasMethod($sort)) {
} elseif ($sort !== null && $object->hasMethod($sort)) {
$sorter = 'object';
} else {
$sorter = 'db';
Expand Down Expand Up @@ -124,8 +124,11 @@ public static function get_paged($sort = null, $direction = 'asc', $page = 1, $e
}
}
}
$sort_condition_table = substr($sort, 0, strpos($sort, '.'));
$condition_joins[$sort_condition_table] = $sort_condition_table;

if ($sort !== null) {
$sort_condition_table = substr($sort, 0, strpos($sort, '.'));
$condition_joins[$sort_condition_table] = $sort_condition_table;
}

do {
$remove_count = 0;
Expand Down

0 comments on commit 000419d

Please sign in to comment.