Skip to content

Commit

Permalink
Don't allow empty values for comparison
Browse files Browse the repository at this point in the history
Fixes symphonycms#171 (JIT sends 304 responses for deleted originals)
  • Loading branch information
michael-e committed Aug 27, 2019
1 parent 829183f commit a2e8228
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ function __errorHandler($errno=NULL, $errstr, $errfile=NULL, $errline=NULL, $err
// Check to see if the requested image needs to be generated or if a 304
// can just be returned to the browser to use it's cached version.
if(CACHING === true && (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH']))){
if($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $last_modified_gmt || str_replace('"', NULL, stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == $etag){
if (
($last_modified_gmt && ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $last_modified_gmt))
|| ($etag && (str_replace('"', NULL, stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == $etag))
) {
Page::renderStatusCode(Page::HTTP_NOT_MODIFIED);
exit;
}
Expand Down

0 comments on commit a2e8228

Please sign in to comment.