Skip to content
Permalink
Browse files

Replaced is_array() check and set of $keys in array with cast to arra…

…y 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
  • Loading branch information...
trenshaw committed May 31, 2018
1 parent fc061a5 commit adefb973aa28879dee9acb36f11a2af0d944be34
Showing with 4 additions and 7 deletions.
  1. +4 −7 lib/Cake/Model/Datasource/DboSource.php
@@ -3043,15 +3043,12 @@ public function limit($limit, $offset = null) {
* @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)) {

0 comments on commit adefb97

Please sign in to comment.
You can’t perform that action at this time.