File tree Expand file tree Collapse file tree 3 files changed +36
-5
lines changed
src/Symfony/Bridge/PhpUnit
Tests/DeprecationErrorHandler Expand file tree Collapse file tree 3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,11 @@ public static function register($mode = 0)
90
90
}
91
91
}
92
92
93
+ public static function registerAndConfigureFromEnvironment ()
94
+ {
95
+ self ::register (self ::getModeFromEnvironment ());
96
+ }
97
+
93
98
public static function collectDeprecations ($ outputFile )
94
99
{
95
100
$ deprecations = [];
@@ -209,12 +214,28 @@ public function shutdown()
209
214
});
210
215
}
211
216
217
+ /**
218
+ * @return mixed string|false
219
+ */
220
+ private static function getModeFromEnvironment ()
221
+ {
222
+ if (isset ($ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
223
+ return $ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ];
224
+ }
225
+
226
+ if (isset ($ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ])) {
227
+ return $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ];
228
+ }
229
+
230
+ return getenv ('SYMFONY_DEPRECATIONS_HELPER ' );
231
+ }
232
+
212
233
private function getConfiguration ()
213
234
{
214
235
if (null !== $ this ->configuration ) {
215
236
return $ this ->configuration ;
216
237
}
217
- $ mode = getenv ( ' SYMFONY_DEPRECATIONS_HELPER ' );
238
+ $ mode = self :: getModeFromEnvironment ( );
218
239
if ('strict ' === $ mode ) {
219
240
return $ this ->configuration = Configuration::inStrictMode ();
220
241
}
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- Test DeprecationErrorHandler in weak mode
2
+ Test DeprecationErrorHandler in disabled mode
3
3
--FILE--
4
4
<?php
5
5
6
- putenv ( 'SYMFONY_DEPRECATIONS_HELPER= disabled ' ) ;
6
+ $ _SERVER [ 'SYMFONY_DEPRECATIONS_HELPER ' ] = ' disabled ' ;
7
7
putenv ('ANSICON ' );
8
8
putenv ('ConEmuANSI ' );
9
9
putenv ('TERM ' );
Original file line number Diff line number Diff line change 35
35
}
36
36
}
37
37
38
- if ('disabled ' !== getenv ('SYMFONY_DEPRECATIONS_HELPER ' )) {
39
- DeprecationErrorHandler::register (getenv ('SYMFONY_DEPRECATIONS_HELPER ' ));
38
+ if (isset ($ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ]) && 'disabled ' === $ _SERVER ['SYMFONY_DEPRECATIONS_HELPER ' ]) {
39
+ return ;
40
+ }
41
+
42
+ if (isset ($ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ]) && 'disabled ' === $ _ENV ['SYMFONY_DEPRECATIONS_HELPER ' ]) {
43
+ return ;
40
44
}
45
+
46
+ if ('disabled ' === getenv ('SYMFONY_DEPRECATIONS_HELPER ' )) {
47
+ return ;
48
+ }
49
+
50
+ DeprecationErrorHandler::registerAndConfigureFromEnvironment ();
You can’t perform that action at this time.
0 commit comments