ini_set changes the value of the given configuration option for the duration of the script’s execution. While there may be a reason to
do this, you should make sure that it’s a very good reason indeed, because this is the sort of "magic" change which can cause severe teeth-gnashing
and hair tearing when the script needs to be debugged.
For instance, if the user explicitly turns logging on for a script, but then the script itself uses
ini_set('display_errors', 0); to
turn logging back off, it is likely that every other aspect of the environment will be examined before, in desperation, the script is read to figure
out where the logging is going.
Noncompliant Code Example
ini_set('display_errors', 0); // Noncompliant