1.2.1479. error_reporting() With Integers¶
Using named constants with error_reporting is strongly encouraged to ensure compatibility for future versions. As error levels are added, the range of integers increases, so older integer-based error levels will not always behave as expected. (Adapted from the documentation).
<?php
// This is ready for PHP next version
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING);
// This is not ready for PHP next version
error_reporting(2047);
// -1 and 0 are omitted, as they will be valid even is constants changes.
error_reporting(-1);
error_reporting(0);
?>
See also directive error_reporting and error_reporting.
1.2.1479.1. Suggestions¶
Always use the constant combination when configuring error_reporting or any PHP native function
1.2.1479.2. Specs¶
Short name |
Structures/ErrorReportingWithInteger |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Examples |
|
Available in |