@@ -218,20 +218,21 @@ final public function is_escaping_function( $functionName ) {
218
218
if ( array () === $ this ->allEscapingFunctions
219
219
|| $ this ->customEscapingFunctions !== $ this ->addedCustomEscapingFunctions ['escape ' ]
220
220
) {
221
+ /*
222
+ * Lowercase all names, both custom as well as "known", as PHP treats namespaced names case-insensitively.
223
+ */
224
+ $ custom_escaping_functions = array_map ( 'strtolower ' , $ this ->customEscapingFunctions );
225
+ $ escaping_functions = array_change_key_case ( $ this ->escapingFunctions , \CASE_LOWER );
226
+
221
227
$ this ->allEscapingFunctions = RulesetPropertyHelper::merge_custom_array (
222
- $ this -> customEscapingFunctions ,
223
- $ this -> escapingFunctions
228
+ $ custom_escaping_functions ,
229
+ $ escaping_functions
224
230
);
225
231
226
232
$ this ->addedCustomEscapingFunctions ['escape ' ] = $ this ->customEscapingFunctions ;
227
233
}
228
234
229
- // Check if the $functionName is a static method or not.
230
- if ( strpos ( $ functionName , ':: ' ) === false ) {
231
- $ functionName = strtolower ( $ functionName );
232
- }
233
-
234
- return isset ( $ this ->allEscapingFunctions [ $ functionName ] );
235
+ return isset ( $ this ->allEscapingFunctions [ strtolower ( $ functionName ) ] );
235
236
}
236
237
237
238
/**
@@ -247,9 +248,15 @@ final public function is_auto_escaped_function( $functionName ) {
247
248
if ( array () === $ this ->allAutoEscapedFunctions
248
249
|| $ this ->customAutoEscapedFunctions !== $ this ->addedCustomEscapingFunctions ['autoescape ' ]
249
250
) {
251
+ /*
252
+ * Lowercase all names, both custom as well as "known", as PHP treats namespaced names case-insensitively.
253
+ */
254
+ $ custom_auto_escaped_functions = array_map ( 'strtolower ' , $ this ->customAutoEscapedFunctions );
255
+ $ auto_escaped_functions = array_change_key_case ( $ this ->autoEscapedFunctions , \CASE_LOWER );
256
+
250
257
$ this ->allAutoEscapedFunctions = RulesetPropertyHelper::merge_custom_array (
251
- $ this -> customAutoEscapedFunctions ,
252
- $ this -> autoEscapedFunctions
258
+ $ custom_auto_escaped_functions ,
259
+ $ auto_escaped_functions
253
260
);
254
261
255
262
$ this ->addedCustomEscapingFunctions ['autoescape ' ] = $ this ->customAutoEscapedFunctions ;
0 commit comments