rspec/rules/S2918/php/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

39 lines
1.2 KiB
Plaintext

== Why is this an issue?
``++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
[source,php]
----
ini_set('display_errors', 0); // Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Move this configuration into a configuration file.
'''
== Comments And Links
(visible only on this page)
=== on 6 May 2015, 11:59:31 Ann Campbell wrote:
http://www.reddit.com/r/PHPhelp/comments/2kj41j/sensio_php_configuration_should_not_be_changed/
=== on 7 May 2015, 08:21:04 Linda Martin wrote:
Reviewed.
endif::env-github,rspecator-view[]