Hello Friends.

Welcome to Infinitbility!

In this article, we figure out the solution of Undefined variable: timeMatches and etagMatches cakephp.

Crashed Reason

The following code is from Http\Response::checkNotModified. On the compact line, this actually expects that the variables to be compacted actually do exist. This is a poor variable existence check and causes the above notices to be output, which further break the application as it can no longer output headers.


Change some code on your cakephp package

Step 1

open your Network folder on your cakephp package and edit Response.php

cd vendor/cakephp/cakephp/src/Network/

Edit Response.php

sudo vim Response.php

Step 2

Go To line no 1299 or find code like below on your Response.php

$checks = compact('etagMatches', 'timeMatches');
if (empty($checks)) {
    return false;

Replace with below code

if (!isset($etagMatches, $timeMatches)) {
    return false;
$checks = compact('etagMatches', 'timeMatches')

Thanks for reading…