- Affected version
- 2.2.5
php supports converting a number of functions from function calls into specific bytecode as a fast-pass. This however requires the function be pulled from the global namespace, and in XF virtually call code is called from non-global namespace, which defeats this optimization.
A simple way would be to include something like this after the namespace declaration, in each file;
There doesn't appear to be any nice way to append this list into say an include file php just throws a "The use statement with non-compound name" error with php 7.x
Using this regex, there is about 2600 hits in the
A simple way would be to include something like this after the namespace declaration, in each file;
PHP:
use function strlen, is_null, is_bool, is_long, is_int, is_integer, is_float, is_double, is_string, is_array, is_object, is_resource, is_scalar, boolval, intval, floatval, doubleval, strval, defined, chr, ord, call_user_func_array, call_user_func, in_array, count, sizeof, get_class, get_called_class, gettype, func_num_args, func_get_args, array_slice, array_key_exists;
Using this regex, there is about 2600 hits in the
src/XF
, some may be false positives.
Code:
[^\\>a-zA-Z_-](strlen|is_null|is_bool|is_long|is_int|is_integer|is_float|is_double|is_string|is_array|is_object|is_resource|is_scalar|boolval|intval|floatval|doubleval|strval|defined|chr|ord|call_user_func_array|call_user_func|in_array|count|sizeof|get_class|get_called_class|gettype|func_num_args|func_get_args|array_slice|array_key_exists)\s*\(