Paul
Paul

Reputation: 51

PHP with error_reporting E_ALL ignores <?php}?> while it should error

I had made a booboo in a script by writing <?php}?> instead of <?php }?>. My local Xampp server did not complain and happily served the file, while my actual server served a blank page and generated an error log (as would be expected, as <?php should be following by a space or line break).

This made me wonder why my local PHP is simply ignoring it.

I have compared both servers. My local server runs PHP 8.0.28 and remote server 8.0.30. Both servers have error reporting level E_ALL. PHP file header has error_reporting(E_ALL);

Local server php.ini error settings:

error_reporting=E_ALL
display_errors=On
display_startup_errors=On
log_errors=On

Yet, it still doesn't show an error (or notice, for that matter). When testing with a simple undefined variable to test the error level, it throws a notice - so the error reporting works fine. Also tested by echo error_reporting();, which echos 32767 (E_ALL).

Why is my local PHP not throwing an error?

Upvotes: 1

Views: 40

Answers (0)

Related Questions