-1

One of our websites earlier today started outputting a few PHP warnings that were only visible through Firefox but weirdly the errors wouldn't show in Chrome or Safari.

I had a look at the request/response headers and noticed in the response header for Firefox the entry

    X-pad: avoid browser bug

Could this be the reason for the discrepancy in between the two browsers? From what I could find, X-pad was a work around for a bug that existed in an ancient browser.

Below is a screenshot of the errors from Firefox.

Error Message

Edit.

Found out the cause of the error and also why chrome wasn't showing the warnings. A number of pages on our site had been injected with some code, as documented here. The code was ignoring safari and chrome , but not Firefox. Hence the discrepancy.

As for the fix, simply remove any instances of the code. Affected, were instances of index.php/template.php/page.php files.

Pedder
  • 103
  • 1
  • 6
  • Can you give us a link to the live site?. I would like to check if the error appears in the source of both browsers. – The Marlboro Man Aug 14 '13 at 09:59
  • 1
    Please paste the error messages as text, not as screenshot. And show line 22 of the file that's throwing the warning about line 22. – JJJ Aug 14 '13 at 10:00
  • 3
    I guess they're still in the source for both, it's just that the browsers render invalid html differently. – Maerlyn Aug 14 '13 at 10:00
  • Turn error reporting off for notices or fix the notice. You are accessing a variable or array/string index that is not set before. – Daniel W. Aug 14 '13 at 10:06
  • @Maerlyn -Errors only showed up in firefox. – Pedder Aug 14 '13 at 12:05

1 Answers1

0

Uninitialized string you get because your variable is not setted in an array. Make sure that is setted.

 if (isset($somevar['var']))
 {
      // etc..
 }

Your session_start() code is NOT on your TOP in a PHP file. A session_start() should be called before all scripts executed.

To turn off showing errors manually via PHP put on top:

 ini_set("display_errors", 0);

Put all your errors to error.log file instead of showing errors on PHP production environment.

X-Pad is header appender to the response from apache. So this isn't way what errors occured. X-Pad doesn't relation with your errors.

Community
  • 1
  • 1
Marin Sagovac
  • 3,932
  • 5
  • 23
  • 53