forked from WordPress/WordPress-Coding-Standards
/
IniSetStandard.xml
36 lines (36 loc) · 1.13 KB
/
IniSetStandard.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<documentation title="Detect incorrect use of the `ini_set()` function.">
<standard>
<![CDATA[
Using ini_set() for alternating PHP settings, as well as other functions with ability to change configuration at runtime of your scripts is discouraged. Changing runtime configuration might break other plugins and themes.
]]>
</standard>
<code_comparison>
<code title="ini_set() for a possibly breaking setting">
<![CDATA[
ini_set( 'short_open_tag', 'off' );
]]>
</code>
<code title="ini_set() for a possibly breaking setting">
<![CDATA[
// ini_set should not be used.
]]>
</code>
</code_comparison>
<standard>
<![CDATA[
For some configuration values there are WordPress functions. These are preferred.
]]>
</standard>
<code_comparison>
<code title="ini_set() to alter memory limits.">
<![CDATA[
ini_set( 'memory_limit', '256M' );
]]>
</code>
<code title="WordPress functional alternative">
<![CDATA[
wp_raise_memory_limit();
]]>
</code>
</code_comparison>
</documentation>