|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Deprecated ini directives sniff test file |
|
4
|
|
|
* |
|
5
|
|
|
* @package PHPCompatibility |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Deprecated ini directives sniff tests |
|
11
|
|
|
* |
|
12
|
|
|
* @uses BaseSniffTest |
|
13
|
|
|
* @package PHPCompatibility |
|
14
|
|
|
* @author Jansen Price <[email protected]> |
|
15
|
|
|
*/ |
|
16
|
|
|
class DeprecatedIniDirectivesSniffTest extends BaseSniffTest |
|
|
|
|
|
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Test define_syslog_variables |
|
20
|
|
|
* |
|
21
|
|
|
* @return void |
|
22
|
|
|
*/ |
|
23
|
|
View Code Duplication |
public function testDefineSyslogVariables() |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
26
|
|
|
$this->assertWarning($file, 3, "INI directive 'define_syslog_variables' is deprecated from PHP 5.3"); |
|
27
|
|
|
$this->assertWarning($file, 4, "INI directive 'define_syslog_variables' is deprecated from PHP 5.3"); |
|
28
|
|
|
|
|
29
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
30
|
|
|
$this->assertError($file, 3, "INI directive 'define_syslog_variables' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
31
|
|
|
$this->assertWarning($file, 4, "INI directive 'define_syslog_variables' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Test register_globals |
|
36
|
|
|
* |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
View Code Duplication |
public function testRegisterGlobals() |
|
|
|
|
|
|
40
|
|
|
{ |
|
41
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
42
|
|
|
$this->assertWarning($file, 6, "INI directive 'register_globals' is deprecated from PHP 5.3"); |
|
43
|
|
|
$this->assertWarning($file, 7, "INI directive 'register_globals' is deprecated from PHP 5.3"); |
|
44
|
|
|
|
|
45
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
46
|
|
|
$this->assertError($file, 6, "INI directive 'register_globals' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
47
|
|
|
$this->assertWarning($file, 7, "INI directive 'register_globals' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Test register_long_arrays |
|
52
|
|
|
* |
|
53
|
|
|
* @return void |
|
54
|
|
|
*/ |
|
55
|
|
View Code Duplication |
public function testRegisterLongArrays() |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
58
|
|
|
$this->assertWarning($file, 9, "INI directive 'register_long_arrays' is deprecated from PHP 5.3"); |
|
59
|
|
|
$this->assertWarning($file, 10, "INI directive 'register_long_arrays' is deprecated from PHP 5.3"); |
|
60
|
|
|
|
|
61
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
62
|
|
|
$this->assertError($file, 9, "INI directive 'register_long_arrays' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
63
|
|
|
$this->assertWarning($file, 10, "INI directive 'register_long_arrays' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Test magic_quotes_gpc |
|
68
|
|
|
* |
|
69
|
|
|
* @return void |
|
70
|
|
|
*/ |
|
71
|
|
View Code Duplication |
public function testMagicQuotesGpc() |
|
|
|
|
|
|
72
|
|
|
{ |
|
73
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
74
|
|
|
$this->assertWarning($file, 12, "INI directive 'magic_quotes_gpc' is deprecated from PHP 5.3"); |
|
75
|
|
|
$this->assertWarning($file, 13, "INI directive 'magic_quotes_gpc' is deprecated from PHP 5.3"); |
|
76
|
|
|
|
|
77
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
78
|
|
|
$this->assertError($file, 12, "INI directive 'magic_quotes_gpc' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
79
|
|
|
$this->assertWarning($file, 13, "INI directive 'magic_quotes_gpc' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Test magic_quotes_runtime |
|
84
|
|
|
* |
|
85
|
|
|
* @return void |
|
86
|
|
|
*/ |
|
87
|
|
View Code Duplication |
public function testMagicQuotesRuntime() |
|
|
|
|
|
|
88
|
|
|
{ |
|
89
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
90
|
|
|
$this->assertWarning($file, 15, "INI directive 'magic_quotes_runtime' is deprecated from PHP 5.3"); |
|
91
|
|
|
$this->assertWarning($file, 16, "INI directive 'magic_quotes_runtime' is deprecated from PHP 5.3"); |
|
92
|
|
|
|
|
93
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
94
|
|
|
$this->assertError($file, 15, "INI directive 'magic_quotes_runtime' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
95
|
|
|
$this->assertWarning($file, 16, "INI directive 'magic_quotes_runtime' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Test magic_quotes_sybase |
|
100
|
|
|
* |
|
101
|
|
|
* @return void |
|
102
|
|
|
*/ |
|
103
|
|
View Code Duplication |
public function testMagicQuotesSybase() |
|
|
|
|
|
|
104
|
|
|
{ |
|
105
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
106
|
|
|
$this->assertWarning($file, 18, "INI directive 'magic_quotes_sybase' is deprecated from PHP 5.3"); |
|
107
|
|
|
$this->assertWarning($file, 19, "INI directive 'magic_quotes_sybase' is deprecated from PHP 5.3"); |
|
108
|
|
|
|
|
109
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
110
|
|
|
$this->assertError($file, 18, "INI directive 'magic_quotes_sybase' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
111
|
|
|
$this->assertWarning($file, 19, "INI directive 'magic_quotes_sybase' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Test allow_call_time_pass_reference |
|
116
|
|
|
* |
|
117
|
|
|
* @return void |
|
118
|
|
|
*/ |
|
119
|
|
View Code Duplication |
public function testAllowCallTimePassReference() |
|
|
|
|
|
|
120
|
|
|
{ |
|
121
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
122
|
|
|
$this->assertWarning($file, 21, "INI directive 'allow_call_time_pass_reference' is deprecated from PHP 5.3"); |
|
123
|
|
|
$this->assertWarning($file, 22, "INI directive 'allow_call_time_pass_reference' is deprecated from PHP 5.3"); |
|
124
|
|
|
|
|
125
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
126
|
|
|
$this->assertError($file, 21, "INI directive 'allow_call_time_pass_reference' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
127
|
|
|
$this->assertWarning($file, 22, "INI directive 'allow_call_time_pass_reference' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* Test highlight.bg |
|
132
|
|
|
* |
|
133
|
|
|
* @return void |
|
134
|
|
|
*/ |
|
135
|
|
View Code Duplication |
public function testHighlightBg() |
|
|
|
|
|
|
136
|
|
|
{ |
|
137
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
138
|
|
|
$this->assertWarning($file, 24, "INI directive 'highlight.bg' is deprecated from PHP 5.3"); |
|
139
|
|
|
$this->assertWarning($file, 25, "INI directive 'highlight.bg' is deprecated from PHP 5.3"); |
|
140
|
|
|
|
|
141
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
142
|
|
|
$this->assertError($file, 24, "INI directive 'highlight.bg' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
143
|
|
|
$this->assertWarning($file, 25, "INI directive 'highlight.bg' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* Test session.bug_compat_42 |
|
148
|
|
|
* |
|
149
|
|
|
* @return void |
|
150
|
|
|
*/ |
|
151
|
|
View Code Duplication |
public function testSessionBugCompat42() |
|
|
|
|
|
|
152
|
|
|
{ |
|
153
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
154
|
|
|
$this->assertWarning($file, 27, "INI directive 'session.bug_compat_42' is deprecated from PHP 5.3"); |
|
155
|
|
|
$this->assertWarning($file, 28, "INI directive 'session.bug_compat_42' is deprecated from PHP 5.3"); |
|
156
|
|
|
|
|
157
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
158
|
|
|
$this->assertError($file, 27, "INI directive 'session.bug_compat_42' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
159
|
|
|
$this->assertWarning($file, 28, "INI directive 'session.bug_compat_42' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Test session.bug_compat_warn |
|
164
|
|
|
* |
|
165
|
|
|
* @return void |
|
166
|
|
|
*/ |
|
167
|
|
View Code Duplication |
public function testSessionBugCompatWarn() |
|
|
|
|
|
|
168
|
|
|
{ |
|
169
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
170
|
|
|
$this->assertWarning($file, 30, "INI directive 'session.bug_compat_warn' is deprecated from PHP 5.3"); |
|
171
|
|
|
$this->assertWarning($file, 31, "INI directive 'session.bug_compat_warn' is deprecated from PHP 5.3"); |
|
172
|
|
|
|
|
173
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
174
|
|
|
$this->assertError($file, 30, "INI directive 'session.bug_compat_warn' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
175
|
|
|
$this->assertWarning($file, 31, "INI directive 'session.bug_compat_warn' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Test y2k_compliance |
|
180
|
|
|
* |
|
181
|
|
|
* @return void |
|
182
|
|
|
*/ |
|
183
|
|
View Code Duplication |
public function testY2kCompliance() |
|
|
|
|
|
|
184
|
|
|
{ |
|
185
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
186
|
|
|
$this->assertWarning($file, 33, "INI directive 'y2k_compliance' is deprecated from PHP 5.3"); |
|
187
|
|
|
$this->assertWarning($file, 34, "INI directive 'y2k_compliance' is deprecated from PHP 5.3"); |
|
188
|
|
|
|
|
189
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
190
|
|
|
$this->assertError($file, 33, "INI directive 'y2k_compliance' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
191
|
|
|
$this->assertWarning($file, 34, "INI directive 'y2k_compliance' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* Test zend.ze1_compatibility_mode |
|
196
|
|
|
* |
|
197
|
|
|
* @return void |
|
198
|
|
|
*/ |
|
199
|
|
|
public function testZendZe1CompatibilityMode() |
|
200
|
|
|
{ |
|
201
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
202
|
|
|
$this->assertError($file, 36, "INI directive 'zend.ze1_compatibility_mode' is forbidden from PHP 5.3"); |
|
203
|
|
|
$this->assertWarning($file, 37, "INI directive 'zend.ze1_compatibility_mode' is forbidden from PHP 5.3"); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* Test safe_mode |
|
208
|
|
|
* |
|
209
|
|
|
* @return void |
|
210
|
|
|
*/ |
|
211
|
|
View Code Duplication |
public function testSafeMode() |
|
|
|
|
|
|
212
|
|
|
{ |
|
213
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
214
|
|
|
$this->assertWarning($file, 39, "INI directive 'safe_mode' is deprecated from PHP 5.3"); |
|
215
|
|
|
$this->assertWarning($file, 40, "INI directive 'safe_mode' is deprecated from PHP 5.3"); |
|
216
|
|
|
|
|
217
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
218
|
|
|
$this->assertError($file, 39, "INI directive 'safe_mode' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
219
|
|
|
$this->assertWarning($file, 40, "INI directive 'safe_mode' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* Test safe_mode_gid |
|
224
|
|
|
* |
|
225
|
|
|
* @return void |
|
226
|
|
|
*/ |
|
227
|
|
View Code Duplication |
public function testSafeModeGid() |
|
|
|
|
|
|
228
|
|
|
{ |
|
229
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
230
|
|
|
$this->assertWarning($file, 42, "INI directive 'safe_mode_gid' is deprecated from PHP 5.3"); |
|
231
|
|
|
$this->assertWarning($file, 43, "INI directive 'safe_mode_gid' is deprecated from PHP 5.3"); |
|
232
|
|
|
|
|
233
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
234
|
|
|
$this->assertError($file, 42, "INI directive 'safe_mode_gid' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
235
|
|
|
$this->assertWarning($file, 43, "INI directive 'safe_mode_gid' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* Test safe_mode_include_dir |
|
240
|
|
|
* |
|
241
|
|
|
* @return void |
|
242
|
|
|
*/ |
|
243
|
|
View Code Duplication |
public function testSafeModeIncludeDir() |
|
|
|
|
|
|
244
|
|
|
{ |
|
245
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
246
|
|
|
$this->assertWarning($file, 45, "INI directive 'safe_mode_include_dir' is deprecated from PHP 5.3"); |
|
247
|
|
|
$this->assertWarning($file, 46, "INI directive 'safe_mode_include_dir' is deprecated from PHP 5.3"); |
|
248
|
|
|
|
|
249
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
250
|
|
|
$this->assertError($file, 45, "INI directive 'safe_mode_include_dir' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
251
|
|
|
$this->assertWarning($file, 46, "INI directive 'safe_mode_include_dir' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
/** |
|
255
|
|
|
* Test safe_mode_exec_dir |
|
256
|
|
|
* |
|
257
|
|
|
* @return void |
|
258
|
|
|
*/ |
|
259
|
|
View Code Duplication |
public function testSafeModeExecDir() |
|
|
|
|
|
|
260
|
|
|
{ |
|
261
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
262
|
|
|
$this->assertWarning($file, 48, "INI directive 'safe_mode_exec_dir' is deprecated from PHP 5.3"); |
|
263
|
|
|
$this->assertWarning($file, 49, "INI directive 'safe_mode_exec_dir' is deprecated from PHP 5.3"); |
|
264
|
|
|
|
|
265
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
266
|
|
|
$this->assertError($file, 48, "INI directive 'safe_mode_exec_dir' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
267
|
|
|
$this->assertWarning($file, 49, "INI directive 'safe_mode_exec_dir' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* Test safe_mode_allowed_env_vars |
|
272
|
|
|
* |
|
273
|
|
|
* @return void |
|
274
|
|
|
*/ |
|
275
|
|
View Code Duplication |
public function testSafeModeAllowedEnvVars() |
|
|
|
|
|
|
276
|
|
|
{ |
|
277
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
278
|
|
|
$this->assertWarning($file, 51, "INI directive 'safe_mode_allowed_env_vars' is deprecated from PHP 5.3"); |
|
279
|
|
|
$this->assertWarning($file, 52, "INI directive 'safe_mode_allowed_env_vars' is deprecated from PHP 5.3"); |
|
280
|
|
|
|
|
281
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
282
|
|
|
$this->assertError($file, 51, "INI directive 'safe_mode_allowed_env_vars' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
283
|
|
|
$this->assertWarning($file, 52, "INI directive 'safe_mode_allowed_env_vars' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* Test safe_mode_protected_env_vars |
|
288
|
|
|
* |
|
289
|
|
|
* @return void |
|
290
|
|
|
*/ |
|
291
|
|
View Code Duplication |
public function testSafeModeProtectedEnvVars() |
|
|
|
|
|
|
292
|
|
|
{ |
|
293
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
294
|
|
|
$this->assertWarning($file, 54, "INI directive 'safe_mode_protected_env_vars' is deprecated from PHP 5.3"); |
|
295
|
|
|
$this->assertWarning($file, 55, "INI directive 'safe_mode_protected_env_vars' is deprecated from PHP 5.3"); |
|
296
|
|
|
|
|
297
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.4'); |
|
298
|
|
|
$this->assertError($file, 54, "INI directive 'safe_mode_protected_env_vars' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
299
|
|
|
$this->assertWarning($file, 55, "INI directive 'safe_mode_protected_env_vars' is deprecated from PHP 5.3 and forbidden from PHP 5.4"); |
|
300
|
|
|
} |
|
301
|
|
|
|
|
302
|
|
|
/** |
|
303
|
|
|
* Test valid directive |
|
304
|
|
|
* |
|
305
|
|
|
* @return void |
|
306
|
|
|
*/ |
|
307
|
|
|
public function testValidDirective() |
|
308
|
|
|
{ |
|
309
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php'); |
|
310
|
|
|
$this->assertNoViolation($file, 57); |
|
311
|
|
|
$this->assertNoViolation($file, 58); |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
/** |
|
315
|
|
|
* Test iconv.input_encoding setting |
|
316
|
|
|
* |
|
317
|
|
|
* @return void |
|
318
|
|
|
*/ |
|
319
|
|
|
public function testIconvInputEncoding() |
|
320
|
|
|
{ |
|
321
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
322
|
|
|
$this->assertNoViolation($file, 62); |
|
323
|
|
|
$this->assertNoViolation($file, 63); |
|
324
|
|
|
|
|
325
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
326
|
|
|
$this->assertWarning($file, 62, "INI directive 'iconv.input_encoding' is deprecated from PHP 5.6"); |
|
327
|
|
|
$this->assertWarning($file, 63, "INI directive 'iconv.input_encoding' is deprecated from PHP 5.6"); |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
/** |
|
331
|
|
|
* Test iconv.output_encoding setting |
|
332
|
|
|
* |
|
333
|
|
|
* @return void |
|
334
|
|
|
*/ |
|
335
|
|
|
public function testIconvOutputEncoding() |
|
336
|
|
|
{ |
|
337
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
338
|
|
|
$this->assertNoViolation($file, 65); |
|
339
|
|
|
$this->assertNoViolation($file, 66); |
|
340
|
|
|
|
|
341
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
342
|
|
|
$this->assertWarning($file, 65, "INI directive 'iconv.output_encoding' is deprecated from PHP 5.6"); |
|
343
|
|
|
$this->assertWarning($file, 66, "INI directive 'iconv.output_encoding' is deprecated from PHP 5.6"); |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
|
/** |
|
347
|
|
|
* Test iconv.internal_encoding setting |
|
348
|
|
|
* |
|
349
|
|
|
* @return void |
|
350
|
|
|
*/ |
|
351
|
|
|
public function testIconvInternalEncoding() |
|
352
|
|
|
{ |
|
353
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
354
|
|
|
$this->assertNoViolation($file, 68); |
|
355
|
|
|
$this->assertNoViolation($file, 69); |
|
356
|
|
|
|
|
357
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
358
|
|
|
$this->assertWarning($file, 68, "INI directive 'iconv.internal_encoding' is deprecated from PHP 5.6"); |
|
359
|
|
|
$this->assertWarning($file, 69, "INI directive 'iconv.internal_encoding' is deprecated from PHP 5.6"); |
|
360
|
|
|
} |
|
361
|
|
|
|
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* Test mbstring.http_input setting |
|
365
|
|
|
* |
|
366
|
|
|
* @return void |
|
367
|
|
|
*/ |
|
368
|
|
|
public function testMbstringHttpInput() |
|
369
|
|
|
{ |
|
370
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
371
|
|
|
$this->assertNoViolation($file, 71); |
|
372
|
|
|
$this->assertNoViolation($file, 72); |
|
373
|
|
|
|
|
374
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
375
|
|
|
$this->assertWarning($file, 71, "INI directive 'mbstring.http_input' is deprecated from PHP 5.6"); |
|
376
|
|
|
$this->assertWarning($file, 72, "INI directive 'mbstring.http_input' is deprecated from PHP 5.6"); |
|
377
|
|
|
} |
|
378
|
|
|
|
|
379
|
|
|
/** |
|
380
|
|
|
* Test mbstring.http_output setting |
|
381
|
|
|
* |
|
382
|
|
|
* @return void |
|
383
|
|
|
*/ |
|
384
|
|
|
public function testMbstringHttpOutput() |
|
385
|
|
|
{ |
|
386
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
387
|
|
|
$this->assertNoViolation($file, 74); |
|
388
|
|
|
$this->assertNoViolation($file, 75); |
|
389
|
|
|
|
|
390
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
391
|
|
|
$this->assertWarning($file, 74, "INI directive 'mbstring.http_output' is deprecated from PHP 5.6"); |
|
392
|
|
|
$this->assertWarning($file, 75, "INI directive 'mbstring.http_output' is deprecated from PHP 5.6"); |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* Test mbstring.internal_encoding setting |
|
397
|
|
|
* |
|
398
|
|
|
* @return void |
|
399
|
|
|
*/ |
|
400
|
|
|
public function testMbstringInternalEncoding() |
|
401
|
|
|
{ |
|
402
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
403
|
|
|
$this->assertNoViolation($file, 77); |
|
404
|
|
|
$this->assertNoViolation($file, 78); |
|
405
|
|
|
|
|
406
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
407
|
|
|
$this->assertWarning($file, 77, "INI directive 'mbstring.internal_encoding' is deprecated from PHP 5.6"); |
|
408
|
|
|
$this->assertWarning($file, 78, "INI directive 'mbstring.internal_encoding' is deprecated from PHP 5.6"); |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* Test always_populate_raw_post_data setting |
|
413
|
|
|
* |
|
414
|
|
|
* @return void |
|
415
|
|
|
*/ |
|
416
|
|
|
public function testAlwaysPopulateRawPostData() |
|
417
|
|
|
{ |
|
418
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.5'); |
|
419
|
|
|
$this->assertNoViolation($file, 80); |
|
420
|
|
|
$this->assertNoViolation($file, 81); |
|
421
|
|
|
|
|
422
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
423
|
|
|
$this->assertWarning($file, 80, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6"); |
|
424
|
|
|
$this->assertWarning($file, 81, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6"); |
|
425
|
|
|
|
|
426
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '7.0'); |
|
427
|
|
|
$this->assertError($file, 80, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6 and forbidden from PHP 7.0"); |
|
428
|
|
|
$this->assertWarning($file, 81, "INI directive 'always_populate_raw_post_data' is deprecated from PHP 5.6 and forbidden from PHP 7.0"); |
|
429
|
|
|
} |
|
430
|
|
|
|
|
431
|
|
|
/** |
|
432
|
|
|
* Test asp_tags setting |
|
433
|
|
|
* |
|
434
|
|
|
* @return void |
|
435
|
|
|
*/ |
|
436
|
|
|
public function testAsptags() |
|
437
|
|
|
{ |
|
438
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
439
|
|
|
$this->assertNoViolation($file, 83); |
|
440
|
|
|
$this->assertNoViolation($file, 84); |
|
441
|
|
|
|
|
442
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '7.0'); |
|
443
|
|
|
$this->assertError($file, 83, "INI directive 'asp_tags' is forbidden from PHP 7.0"); |
|
444
|
|
|
$this->assertWarning($file, 84, "INI directive 'asp_tags' is forbidden from PHP 7.0"); |
|
445
|
|
|
} |
|
446
|
|
|
|
|
447
|
|
|
/** |
|
448
|
|
|
* Test xsl.security_prefs setting |
|
449
|
|
|
* |
|
450
|
|
|
* @return void |
|
451
|
|
|
*/ |
|
452
|
|
|
public function testXslSecurityPrefs() |
|
453
|
|
|
{ |
|
454
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.6'); |
|
455
|
|
|
$this->assertNoViolation($file, 86); |
|
456
|
|
|
$this->assertNoViolation($file, 87); |
|
457
|
|
|
|
|
458
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '7.0'); |
|
459
|
|
|
$this->assertError($file, 86, "INI directive 'xsl.security_prefs' is forbidden from PHP 7.0"); |
|
460
|
|
|
$this->assertWarning($file, 87, "INI directive 'xsl.security_prefs' is forbidden from PHP 7.0"); |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
|
|
464
|
|
|
public function testSettingTestVersion() |
|
465
|
|
|
{ |
|
466
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', '5.3'); |
|
467
|
|
|
|
|
468
|
|
|
$this->assertWarning($file, 54, "INI directive 'safe_mode_protected_env_vars' is deprecated from PHP 5.3"); |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
|
|
/** |
|
472
|
|
|
* testDeprecatedWithAlternative |
|
473
|
|
|
* |
|
474
|
|
|
* @dataProvider dataDeprecatedWithAlternative |
|
475
|
|
|
* |
|
476
|
|
|
* @return void |
|
477
|
|
|
*/ |
|
478
|
|
|
public function testDeprecatedWithAlternative($iniName, $deprecatedIn, $alternative, $lines, $okVersion) |
|
479
|
|
|
{ |
|
480
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', $okVersion); |
|
481
|
|
|
foreach($lines as $line) { |
|
482
|
|
|
$this->assertNoViolation($file, $line); |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', $deprecatedIn); |
|
486
|
|
|
$this->assertError($file, $lines[0], "INI directive '{$iniName}' is forbidden from PHP {$deprecatedIn}. Use '{$alternative}' instead."); |
|
487
|
|
|
$this->assertWarning($file, $lines[1], "INI directive '{$iniName}' is forbidden from PHP {$deprecatedIn}. Use '{$alternative}' instead."); |
|
488
|
|
|
} |
|
489
|
|
|
|
|
490
|
|
|
public function dataDeprecatedWithAlternative() { |
|
491
|
|
|
return array( |
|
492
|
|
|
array('fbsql.batchSize', '5.1', 'fbsql.batchsize', array(89, 90), '5.0'), |
|
493
|
|
|
array('detect_unicode', '5.4', 'zend.detect_unicode', array(125, 126), '5.3'), |
|
494
|
|
|
array('mbstring.script_encoding', '5.4', 'zend.script_encoding', array(128, 129), '5.3'), |
|
495
|
|
|
); |
|
496
|
|
|
} |
|
497
|
|
|
|
|
498
|
|
|
/** |
|
499
|
|
|
* testDeprecatedDirectives |
|
500
|
|
|
* |
|
501
|
|
|
* @dataProvider dataDeprecatedDirectives |
|
502
|
|
|
* |
|
503
|
|
|
* @return void |
|
504
|
|
|
*/ |
|
505
|
|
|
public function testDeprecatedDirectives($iniName, $deprecatedIn, $lines, $okVersion, $errorVersion = null) |
|
506
|
|
|
{ |
|
507
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', $okVersion); |
|
508
|
|
|
foreach($lines as $line) { |
|
509
|
|
|
$this->assertNoViolation($file, $line); |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
if (isset($errorVersion)){ |
|
513
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', $errorVersion); |
|
514
|
|
|
} |
|
515
|
|
|
else { |
|
516
|
|
|
$file = $this->sniffFile('sniff-examples/deprecated_ini_directives.php', $deprecatedIn); |
|
517
|
|
|
} |
|
518
|
|
|
$this->assertError($file, $lines[0], "INI directive '{$iniName}' is forbidden from PHP {$deprecatedIn}."); |
|
519
|
|
|
$this->assertWarning($file, $lines[1], "INI directive '{$iniName}' is forbidden from PHP {$deprecatedIn}."); |
|
520
|
|
|
} |
|
521
|
|
|
|
|
522
|
|
|
public function dataDeprecatedDirectives() { |
|
523
|
|
|
return array( |
|
524
|
|
|
array('ifx.allow_persistent', '5.2.1', array(92, 93), '5.1', '5.3'), |
|
525
|
|
|
array('ifx.blobinfile', '5.2.1', array(95, 96), '5.1', '5.3'), |
|
526
|
|
|
array('ifx.byteasvarchar', '5.2.1', array(98, 99), '5.1', '5.3'), |
|
527
|
|
|
array('ifx.charasvarchar', '5.2.1', array(101, 102), '5.1', '5.3'), |
|
528
|
|
|
array('ifx.default_host', '5.2.1', array(104, 105), '5.1', '5.3'), |
|
529
|
|
|
array('ifx.default_password', '5.2.1', array(107, 108), '5.1', '5.3'), |
|
530
|
|
|
array('ifx.default_user', '5.2.1', array(110, 111), '5.1', '5.3'), |
|
531
|
|
|
array('ifx.max_links', '5.2.1', array(113, 114), '5.1', '5.3'), |
|
532
|
|
|
array('ifx.max_persistent', '5.2.1', array(116, 117), '5.1', '5.3'), |
|
533
|
|
|
array('ifx.nullformat', '5.2.1', array(119, 120), '5.1', '5.3'), |
|
534
|
|
|
array('ifx.textasvarchar', '5.2.1', array(122, 123), '5.1', '5.3'), |
|
535
|
|
|
); |
|
536
|
|
|
} |
|
537
|
|
|
|
|
538
|
|
|
} |
|
539
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.