budgetneon / v2pagecache

Page Cache for OpenCart V2.X
58 stars 26 forks source link

PHP warnings After update #19

Closed gags88 closed 8 years ago

gags88 commented 8 years ago

Hi, this is continuation of thread https://github.com/budgetneon/v2pagecache/issues/18

After changing to new file, There are many PHP warnings:

2016-10-18 21:28:40 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:28:40 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:28:42 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/vqmod/vqcache/vq2-catalog_controller_module_lastviewed.php on line 32 2016-10-18 21:34:15 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:34:15 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:34:16 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/vqmod/vqcache/vq2-catalog_controller_module_lastviewed.php on line 32 2016-10-18 21:39:51 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:39:51 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:39:51 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/response.php on line 12 2016-10-18 21:43:56 - 2016-10-18 21:43:56 - 2016-10-18 21:45:27 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:45:27 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:45:28 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:45:28 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:45:29 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/vqmod/vqcache/vq2-catalog_controller_module_lastviewed.php on line 32 2016-10-18 21:45:32 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:45:32 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:51:02 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/index.php on line 240 2016-10-18 21:51:02 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:51:04 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:64) in /home/abc/public_html/vqmod/vqcache/vq2-catalog_controller_module_lastviewed.php on line 32

budgetneon commented 8 years ago

Not sure what that is. What is the code on line 64 of system/library/v2pagecache.php ?

budgetneon commented 8 years ago

Also, did you clear the cache and restart apache or whatever your webserver is?

budgetneon commented 8 years ago

And, also, you did uninstall the old module, and reinstall the new module, right? You didn't just copy/replace a single file, right?

gags88 commented 8 years ago

Clean install helped....

gags88 commented 8 years ago

It is again here.. Now on line 62

Line says if (array_key_exists('language',$svar)) {

budgetneon commented 8 years ago

What's the error? You're showing me code, but not the associated error.

gags88 commented 8 years ago

2016-10-18 21:28:40 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:62) in /home/abc/public_html/index.php on line 240 2016-10-18 21:28:40 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:62) in /home/abc/public_html/system/library/currency.php on line 45 2016-10-18 21:28:42 - PHP Warning: Cannot modify header information - headers already sent by (output started at /home/abc/public_html/system/library/v2pagecache.php:62) in /home/abc/public_html/vqmod/vqcache/vq2-catalog_controller_module_lastviewed.php on line 32

budgetneon commented 8 years ago

I can't reproduce that on my machine, so there's not much I can do about it.

budgetneon commented 8 years ago

Since the error doesn't really relate to the code, it seems like an unclean install or similar. Something where you would want to clear the cache, uninstall, reinstall, restart the web server, restart fastcgi, etc.

gags88 commented 8 years ago

but i am getting it very often.. i have cleared all cache and uninstalled and then installed.. What else i supposed to do?

gags88 commented 8 years ago

i can't restart Webserver as i am on shared hosting

budgetneon commented 8 years ago

Sorry, I have no idea. I cannot reproduce that here. What else would I do?

gags88 commented 8 years ago

What about these errors?

Warning: array_key_exists() expects parameter 2 to be array, null given in /home/abc/public_html/system/library/v2pagecache.php on line 63

Warning: array_key_exists() expects parameter 2 to be array, null given in /home/abc/public_html/system/library/v2pagecache.php on line 70

gags88 commented 8 years ago

I think you need to change the block like as below

$svar=$this->GetSessionVar(); if(isset($svar)){ if (array_key_exists('language',$svar)) { // only accept specific strings for $_SESSION['language'] // (two small letters, optionally followed by - and more letters) if (pregmatch('/^[a-z]{2}-[a-zA-Z]_$/',$svar['language'])) { $this->lang=$svar['language']; } } if (array_key_exists('currency',$svar)) { // only accept 3 consecutive A-Z for $_SESSION['language'] if (preg_match('/^[A-Z]{3}$/',$svar['currency'])) { $this->currency=$svar['currency']; } } }

budgetneon commented 8 years ago

Try editing it and change to: if (is_array($svar) && array_key_exists('language',$svar)) { and if (is_array($svar) && array_key_exists('currency',$svar)) {

If that works for you, I'll create a new version with a similar fix. Probably not today though.

budgetneon commented 8 years ago

I uploaded a new version with those fixes.