From a4e71b3b40e33992fea91d991b2fc07e8ff91be3 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 21 Aug 2018 14:46:58 -0400 Subject: [PATCH] Fixes: * Issue with preg_match() * Undefined variables --- lib/Cake/Model/Datasource/DboSource.php | 2 +- lib/Cake/Network/CakeResponse.php | 4 ++++ lib/Cake/Utility/ObjectCollection.php | 1 + lib/Cake/View/Helper/FormHelper.php | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index cc59edbb3..8eab41468 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -913,7 +913,7 @@ class DboSource extends DataSource { ) ); } - if (preg_match('/^[\w-_\s]*[\w-_]+/', $data)) { + if (preg_match('/^[\w\-_\s]*[\w\-_]+/', $data)) { return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote); } return $this->cacheMethod(__FUNCTION__, $cacheKey, $data); diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 21dfd7b2e..cae6b34a5 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -1164,9 +1164,13 @@ class CakeResponse { $modifiedSince = $request->header('If-Modified-Since'); if ($responseTag = $this->etag()) { $etagMatches = in_array('*', $etags) || in_array($responseTag, $etags); + } else { + $etagMatches = false; } if ($modifiedSince) { $timeMatches = strtotime($this->modified()) === strtotime($modifiedSince); + } else { + $timeMatches = false; } $checks = compact('etagMatches', 'timeMatches'); if (empty($checks)) { diff --git a/lib/Cake/Utility/ObjectCollection.php b/lib/Cake/Utility/ObjectCollection.php index 460ca86d0..77e4ad234 100644 --- a/lib/Cake/Utility/ObjectCollection.php +++ b/lib/Cake/Utility/ObjectCollection.php @@ -95,6 +95,7 @@ abstract class ObjectCollection { if (empty($this->_enabled)) { return true; } + $subject = null; if ($callback instanceof CakeEvent) { $event = $callback; if (is_array($event->data)) { diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 8a15e1d7a..141bde656 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -1060,6 +1060,8 @@ class FormHelper extends AppHelper { if ($options['type'] === 'radio' && isset($options['options'])) { $radioOptions = (array)$options['options']; unset($options['options']); + } else { + $radioOptions = []; } $label = $this->_getLabel($fieldName, $options); @@ -1080,6 +1082,9 @@ class FormHelper extends AppHelper { $dateFormat = $this->_extractOption('dateFormat', $options, 'MDY'); $timeFormat = $this->_extractOption('timeFormat', $options, 12); unset($options['dateFormat'], $options['timeFormat']); + } else { + $dateFormat = 'MDY'; + $timeFormat = 12; } $type = $options['type'];