Skip to content
Permalink
Browse files

PHP 7.3 throws errors when trying to compact undefined vars.

  • Loading branch information...
ADmad committed Sep 29, 2018
1 parent e6d2454 commit 249cbc3d3a00e9eca931f44ee6990312f156e6cc
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/Http/Response.php
@@ -2055,19 +2055,20 @@ public function checkNotModified(ServerRequest $request)
{
$etags = preg_split('/\s*,\s*/', (string)$request->getHeaderLine('If-None-Match'), 0, PREG_SPLIT_NO_EMPTY);
$responseTag = $this->getHeaderLine('Etag');
$etagMatches = null;
if ($responseTag) {
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
}
$modifiedSince = $request->getHeaderLine('If-Modified-Since');
$timeMatches = null;
if ($modifiedSince && $this->hasHeader('Last-Modified')) {
$timeMatches = strtotime($this->getHeaderLine('Last-Modified')) === strtotime($modifiedSince);
}
$checks = compact('etagMatches', 'timeMatches');
if (empty($checks)) {
if ($etagMatches === null && $timeMatches === null) {
return false;
}
$notModified = !in_array(false, $checks, true);
$notModified = $etagMatches !== false && $timeMatches !== false;
if ($notModified) {
$this->notModified();
}

0 comments on commit 249cbc3

Please sign in to comment.
You can’t perform that action at this time.