From 6639101a509e1a8cb12836c40ff4565de2e0403c Mon Sep 17 00:00:00 2001 From: Martijn Heesters Date: Thu, 2 May 2019 15:47:51 +0200 Subject: [PATCH] Fixed incorrectly identifying get_magic_quotes_runtime as deprecated I'm getting results like these: ``` /var/www/something/FileByteStream.php deprecatedFunctions Line 42: if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) { ``` It looks like the script falsely identifies `get_magic_quotes_runtime` as being a deprecated function. It's not: https://www.php.net/manual/en/function.get-magic-quotes-runtime.php whereare magic_quotes_runtime is indeed deprecated: https://www.php.net/manual/en/function.magic-quotes-runtime.php I've extented the regex so that the target shouldn't be preceded by a underscore. --- classes/tests/critical.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/tests/critical.php b/classes/tests/critical.php index 95e9c2e..0a34e55 100644 --- a/classes/tests/critical.php +++ b/classes/tests/critical.php @@ -112,7 +112,7 @@ public function _reservedNames($line) { * @return boolean Line matches test. */ public function _deprecatedFunctions($line) { - $regex = "#(?:mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mcrypt_generic_end|mcrypt_ecb|mcrypt_cbc|mcrypt_cfb|mcrypt_ofb|set_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking)\(#i"; + $regex = "#[^_](?:mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mcrypt_generic_end|mcrypt_ecb|mcrypt_cbc|mcrypt_cfb|mcrypt_ofb|set_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking)\(#i"; if (preg_match($regex, $line)) { return true; }