File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/Standards/Generic/Sniffs/PHP Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -74,15 +74,24 @@ public function register()
74
74
75
75
// If we are not pattern matching, we need to work out what
76
76
// tokens to listen for.
77
- $ tokens = [];
77
+ $ string = '<?php ' ;
78
+ $ hasHaltCompiler = false ;
78
79
foreach ($ this ->forbiddenFunctionNames as $ name ) {
79
- $ token = token_get_all (sprintf ('<?php %s(); ' , $ name ));
80
- array_shift ($ token );
81
- $ tokens = array_merge ($ tokens , $ token );
80
+ if ($ name === '__halt_compiler ' ) {
81
+ $ hasHaltCompiler = true ;
82
+ } else {
83
+ $ string .= $ name .'(); ' ;
84
+ }
85
+ }
86
+
87
+ if ($ hasHaltCompiler ) {
88
+ $ string .= '__halt_compiler(); ' ;
82
89
}
83
90
84
91
$ register = [];
85
92
93
+ $ tokens = token_get_all ($ string );
94
+ array_shift ($ tokens );
86
95
foreach ($ tokens as $ token ) {
87
96
if (is_array ($ token ) === true ) {
88
97
$ register [] = $ token [0 ];
You can’t perform that action at this time.
0 commit comments