From 18850d8779ebff0ce65e282189afb3e74531d367 Mon Sep 17 00:00:00 2001 From: raTmole Date: Tue, 23 Oct 2018 14:58:07 +0300 Subject: [PATCH 1/2] API getVersion Fix -> Undefined variable: eTagMatches... (#2268) see https://github.com/cakephp/cakephp/issues/12536 --- web/api/lib/Cake/Network/CakeResponse.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/api/lib/Cake/Network/CakeResponse.php b/web/api/lib/Cake/Network/CakeResponse.php index 21dfd7b2e..982398e87 100644 --- a/web/api/lib/Cake/Network/CakeResponse.php +++ b/web/api/lib/Cake/Network/CakeResponse.php @@ -1168,6 +1168,9 @@ class CakeResponse { if ($modifiedSince) { $timeMatches = strtotime($this->modified()) === strtotime($modifiedSince); } + if (!isset($etagMatches, $timeMatches)) { + return false; + } $checks = compact('etagMatches', 'timeMatches'); if (empty($checks)) { return false; From 115141bf9f13c2b7272f00651f7b6a0748059026 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 24 Oct 2018 10:02:42 -0400 Subject: [PATCH 2/2] add caching to Group::find --- web/includes/Group.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/includes/Group.php b/web/includes/Group.php index df9fd611e..6c8338a55 100644 --- a/web/includes/Group.php +++ b/web/includes/Group.php @@ -95,13 +95,12 @@ class Group { } } } # end if options - $groups = array(); - $result = dbQuery($sql, $values); - $results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Group'); - foreach ( $results as $row => $obj ) { - $groups[] = $obj; + + $results = dbFetchAll($sql, NULL, $values); + if ( $results ) { + return array_map( function($row){ return new Group($row); }, $results ); } - return $groups; + return array(); } # end find() public static function find_one($parameters = null, $options = null) {