Jump to content

[SOLVED] Admin Error Logs in AdminController.php & Uploader.php


facethefuture

Recommended Posts

I am receiving errors in my logs everytime an order is manually added or a product is manually added. Please see below and advise if anyone can provide a fix to these issues?
 
Error 1: When a manual order is added
 
PHP Warning: Cannot modify header information - headers already sent by (output started at public_html/controllers/admin/AdminCartsController.php:465) in public_html/classes/controller/AdminController.php on line 1595
 
Here is the code from line 1595 of AdminController.php

header('Cache-Control: no-store, no-cache');

Error 2: When a new product is added
 
PHP Warning:  Wrong parameter count for clearstatcache() in public_html/classes/Uploader.php on line 274

Here is the code from line 274 of Uploader.php

clearstatcache(true, $file_path);

Are these errors anything to worry about? My shop seems to be working ok, however the error log file generate in my admin folder on the ftp is getting quite large because of these errors.
 
I am using Prestashop 1.6.0.14
 
Thanks

Edited by facethefuture (see edit history)
Link to comment
Share on other sites

"PHP Warning: Cannot modify header information" usually appears because there was an error message or warning. Other possible causes are "echo" debug messages that you inserted and accidental spaces outside the php area.

 

You should look in the source code of page that shows this warning to see what that previous message was (rightclick in your browser on the page and select "show source").

 

In your case there was the message "(output started at public_html/controllers/admin/AdminCartsController.php:465) in public_html/classes/controller/AdminController.php on line 1595)". This is unusual but it may contain a clue.

 

Removing the header () commands what you have done now is not a solution. It just hides the problem.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

"PHP Warning: Cannot modify header information" usually appears because there was an error message or warning. Other possible causes are "echo" debug messages that you inserted and accidental spaces outside the php area.

 

You should look in the source code of page that shows this warning to see what that previous message was (rightclick in your browser on the page and select "show source").

 

In your case there was the message "(output started at public_html/controllers/admin/AdminCartsController.php:465) in public_html/classes/controller/AdminController.php on line 1595)". This is unusual but it may contain a clue.

 

Removing the header () commands what you have done now is not a solution. It just hides the problem.

 

Those errors are really a nightmare. I'm sure it depends on the hosting configuration.

 

Anyway, removing the header line it's not a good idea, so in my case I've preferred in AdminCartsController

substitute the echo

 

echo Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors)));

for

die (Tools::jsonEncode(array_merge($this->ajaxReturnVars(), array('errors' => $errors))));

 

It's less dangerous than removing header in AdminController ..

 

Regards

Link to comment
Share on other sites

  • 1 year later...

I am running 1.6.1.17 and PHP 7.0.22.

I don't know whether this PHP warning came up on 5.6 or if it's only since upgrading.

Everything works but it's a bit annoying having the PHP Warnings. I know how to suppress them but I'd like to know why it's doing it in the first place.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...