mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Replaced is_array() check and set of $keys in array with cast to array of $keys in array_filter()
Replaced assignment of $key and $dir through list() with each() with simply key() and current() per tenkoma's suggestion. Resolves # 11827 each() advances the pointer similar to next() but is being negated this particular case by array_shift() which resets the pointer
This commit is contained in:
parent
fc061a55c4
commit
adefb973aa
1 changed files with 4 additions and 7 deletions
|
@ -3043,15 +3043,12 @@ class DboSource extends DataSource {
|
|||
* @return string ORDER BY clause
|
||||
*/
|
||||
public function order($keys, $direction = 'ASC', Model $Model = null) {
|
||||
if (!is_array($keys)) {
|
||||
$keys = array($keys);
|
||||
}
|
||||
|
||||
$keys = array_filter($keys);
|
||||
|
||||
$keys = array_filter((array) $keys);
|
||||
|
||||
$result = array();
|
||||
while (!empty($keys)) {
|
||||
list($key, $dir) = each($keys);
|
||||
$key = key($keys);
|
||||
$dir = current($keys);
|
||||
array_shift($keys);
|
||||
|
||||
if (is_numeric($key)) {
|
||||
|
|
Loading…
Reference in a new issue