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) {
$etags = preg_split('/\s*,\s*/', $request->header('If-None-Match'), null, PREG_SPLIT_NO_EMPTY);
$modifiedSince = $request->header('If-Modified-Since');
$etagMatches = $timeMatches = false;
$checks = array();
if ($responseTag = $this->etag()) {
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
$checks[] = in_array('*', $etags) || in_array($responseTag, $etags);
}
if ($modifiedSince) {
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
$checks[] = strtotime($this->modified()) === strtotime($modifiedSince);
}
$checks = compact('etagMatches', 'timeMatches');
if (empty(array_filter($checks))) {
if (empty($checks)) {
return false;
}
$notModified = !in_array(false, $checks, true);