johnlemon
johnlemon

Reputation: 21509

E_PARSE and error_reporting

From the manual:

error_reporting(E_ERROR | E_WARNING | E_PARSE);

If E_PARSE it's a compile time error does it make sense to use it in error_reporting function?

Take this script for example:

error_reporting(E_ALL ^ E_PARSE);
x = 1;

The parse error will still be displayed if php.ini activated it.

Upvotes: 1

Views: 1936

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191819

In case there are parse errors in included files:

<?php /* good.php */
error_reporting(E_ALL ^ E_PARSE);
include 'bad.php';
?>

<?php /* bad.php */
z = 1;
?>

This is probably also for consistency with ini settings that would disable error reporting of E_PARSE.

Upvotes: 1

Related Questions