Jump to content

"Parse error: syntax error" on Safari, but not on Firefox


phdphd

Recommended Posts

Hi All,

 

While testing my PHP code on Firefox and Safari, I noticed that one error of type "Parse error: syntax error, unexpected ')'" would display on Safari, but not on FF. Very strange... (Actually there is no extra ')' anyway.)

 

This error appears while clicking repeatedly the back button in the Safari toolbar, once the user has gone through the whole process one way. Doing the same in Firefox does not trigger any error.

 

 

I thought "Is there really an error on Safari ? If so, it must be possible to record it in a log file".

 

So, to simulate the user's environment, and record all the errors in a .log file, while preventing them to display, I inserted the following lines at the beginning of the script in the file that is mentioned in the error message :

 

error_reporting(E_ALL | E_STRICT);

ini_set('error_log', 'test.log');
ini_set('log_errors', 'On');
ini_set('display_errors', 'Off');

 

Unfortunately, not only I still get the error of type "Parse error: syntax error, unexpected ')'" , but also this error is not recorded into the log file, despite the fact that I did put the error managing code in the PHP file stated in the error message (and that file contains only one PHP script, so no risk to put the error managing code in a wrong script).

 

To test whether that code is functional, I added

 

1/0;

 

in order to test the division by zero.

 

Now, the error related to the "division by zero" instruction does not display and it is recorded in the .log file, which means that the code is functional. However, the error of type "Parse error: syntax error, unexpected ')'" still displays and does not get recorded into the log file.

 

Any idea of what is going wrong on Safari ?

 

It would be annoying having error messages display in a browser (and possibly reveal some sensitive coding data) while there is actually no error.

 

Thanks for your help.

 

Link to comment
Share on other sites

It's likely that the resulting html is broken on the page and one browser renders the portion where the php error is occurring at and displays it, while the other browser doesn't display that portion of the page and the php error might appear in the 'view source' of the page.

 

It would take seeing the line number from the error message and seeing the php code up to that point in order for anyone here to have a chance at helping find the problem in the php code.

 

It's also possible that the page displaying the php error is left over from some previous testing and is cached in one browser, but doesn't exist in the other browser's cache at all. Have you tried clearing your browser's cache and then trying to repeat this problem?

Link to comment
Share on other sites

Hi PFMaBiSmAd,

 

Let me put it simple in just four words : THANK YOU VERY MUCH !

 

Sometimes we search the universe while what we are looking for is at our fingertips.

 

I cleared safari's cache, repeated the process and no error occurred.

 

Thank you again.

 

Have a great day.  You deserve it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.