Rebuilds the solution

This commit is contained in:
Joe 2018-08-22 11:40:41 -04:00
parent 1fca92fb4e
commit 013ecc3f9f

View file

@ -1162,15 +1162,14 @@ class CakeResponse {
public function checkNotModified(CakeRequest $request) { public function checkNotModified(CakeRequest $request) {
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY); $etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
$modifiedSince = $request->header('If-Modified-Since'); $modifiedSince = $request->header('If-Modified-Since');
$etagMatches = $timeMatches = false; $checks = array();
if ($responseTag = $this->etag()) { if ($responseTag = $this->etag()) {
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags); $checks[] = in_array('*', $etags) || in_array($responseTag, $etags);
} }
if ($modifiedSince) { if ($modifiedSince) {
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince); $checks[] = strtotime($this->modified()) === strtotime($modifiedSince);
} }
$checks = compact('etagMatches', 'timeMatches'); if (empty($checks)) {
if (empty(array_filter($checks))) {
return false; return false;
} }
$notModified = !in_array(false, $checks, true); $notModified = !in_array(false, $checks, true);