Skip to content

Commit e7560d1

Browse files
NielsdeBlaauwjrfnl
authored andcommitted
Ini_set: add documentation (#1730)
1 parent ed52f7d commit e7560d1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<documentation title="Detect use of `ini_set()`">
2+
<standard>
3+
<![CDATA[
4+
Using ini_set() and similar functions for altering PHP settings at runtime is discouraged. Changing runtime configuration might break other plugins and themes, and even WordPress itself.
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: ini_set() for a possibly breaking setting.">
9+
<![CDATA[
10+
// ini_set() should not be used.
11+
]]>
12+
</code>
13+
<code title="Invalid: ini_set() for a possibly breaking setting.">
14+
<![CDATA[
15+
ini_set( <em>'short_open_tag'</em>, 'off' );
16+
]]>
17+
</code>
18+
</code_comparison>
19+
<standard>
20+
<![CDATA[
21+
For some configuration values there are alternative ways available - either via WordPress native functionality of via standard PHP - to achieve the same without the risk of breaking interoperability. These alternatives are preferred.
22+
]]>
23+
</standard>
24+
<code_comparison>
25+
<code title="Valid: WordPress functional alternative.">
26+
<![CDATA[
27+
<em>wp_raise_memory_limit();</em>
28+
]]>
29+
</code>
30+
<code title="Invalid: ini_set() to alter memory limits.">
31+
<![CDATA[
32+
ini_set( <em>'memory_limit'</em>, '256M' );
33+
]]>
34+
</code>
35+
</code_comparison>
36+
</documentation>

0 commit comments

Comments
 (0)