mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Rebuilds the solution
This commit is contained in:
parent
1fca92fb4e
commit
013ecc3f9f
1 changed files with 4 additions and 5 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue