kovshenin / surge

Surge is a very simple and fast page caching plugin for WordPress.
GNU General Public License v3.0
157 stars 11 forks source link

Warning when looping through metadata headers #15

Closed kovshenin closed 2 years ago

kovshenin commented 2 years ago

Some users reported a PHP warning in foreach() in include/serve.php on line 76, which is the loop through the headers, saved in the cache metadata. It seems like in some cases, when WordPress doesn't send any headers at all, or only ones that we choose to skip:

https://github.com/kovshenin/surge/blob/main/include/cache.php#L39

The $headers variable is never defined as an array, and is thus saved as null in the metadata, which then causes the warning on display.

t-pabla commented 2 years ago

Hi @kovshenin

I forgot to add couple of more different warning: PHP Warning: stat(): stat failed for /home/XXXi/public_html/blog/wp-content/cache/surge/84/08626814ff77b6fa9a26d4fd8e676f84.WU6Efn.php in /home/XXX/public_html/blog/wp-content/plugins/surge/include/cron.php on line 49

PHP Warning: unlink(/home/XXXni/public_html/blog/wp-content/cache/surge/84/08626814ff77b6fa9a26d4fd8e676f84.WU6Efn.php): No such file or directory in /home/XXX/public_html/gurblog/wp-content/plugins/surge/include/cron.php on line 58

t-pabla commented 2 years ago

Hi @kovshenin,

Just to let you know these errors have not disappeared! Everyday I had to cleanup my error log containing these errors.

I'm waiting for next update whenever that be. Will this be dealt with in next update?

Thanks for this excellent plugin.

kovshenin commented 2 years ago

@t-pabla thanks for the reminder, yes I have fixes for these which will be shipped with the next update.