Jump to content

Log error on White Screen of death


Recommended Posts

Hi all!

I'm running a 1.2 Prestashop website and sometimes I receive emails from customers with complains about a white screen ordering. Most times, the white screen appears after selecting the billing method.

But I try to get the same error (white screen) and I never can't. It's very strange. The error appears sometimes, not always.

Is there any option to log the error on white screen? Maybe send the error by email to the admin?

Thanks for your help :)

Link to comment
Share on other sites

You can turn on error reporting /config/config.inc.php in line #3 or 4 (change off to on)

It will display the error on the site, and the customer would be able to let you know what happened.

The errors should also appear in your error log (check your host's cpanel for the error log)

Link to comment
Share on other sites

I have found this function in class/Tools.php

       /**
       * Display an error according to an error code
       *
       * @param integer $code Error code
       */
       static public function displayError($string = 'Hack attempt', $htmlentities = true)
       {
               global $_ERRORS;

               //d(debug_backtrace());
               if (!is_array($_ERRORS))
                       return str_replace('"', '"', $string);
               $key = md5(str_replace('\'', '\\\'', $string));
               $str = (isset($_ERRORS) AND is_array($_ERRORS) AND key_exists($key, $_ERRORS)) ? ($htmlentities ? htmlentities($_ERRORS[$key], ENT_COM
               return str_replace('"', '"', stripslashes($str));
       }



Maybe sending an email to admin before the "return", can I view the problem without disturbing the customer??

I think it's not very nice that a customer get strange error messages.

Link to comment
Share on other sites

Thanks tomerg3 for the help.

Finally, I set this in /config/config.inc.php

error_reporting(E_ALL);
@ini_set('display_errors', 0);
@ini_set('log_errors', 1);
@ini_set('error_log', 'error-log.txt');



Also, I get an email when the function displayError from Tools.php is called.

Now, I have to wait to get the info about errors from white screens. :)

Link to comment
Share on other sites

I think I have found where the problem comes.

It is on the cart.php and the error my customers get is: "invalid token"

Here it fails:

if (Configuration::get('PS_TOKEN_ENABLE') == 1 &&
       strcasecmp(Tools::getToken(false), strval(Tools::getValue('token'))) &&
       $cookie->isLogged() === true)
       $errors[] = Tools::displayError('invalid token');



What is token for ?

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...