PHP8.1에서 DB Table 존재유무 검사시 오류가 나는 describe 대신 show tables like 로 수정, PHP message: PHP Fatal error: Uncaught mysqli_sql_exception: Table

This commit is contained in:
EC2 Default User
2022-03-10 05:31:20 +00:00
parent 1174193b43
commit 26dfe6379f

View File

@ -1593,6 +1593,14 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
// `information_schema` DB로의 접근을 허락하지 않습니다.
$sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql);
if (preg_match("#^desc(?:ribe)?\s+(.*)#i", $sql)) {
$sql = preg_replace_callback("#^desc(?:ribe)?\s+(.*)#i",
function ($m) {
return "show tables like '".str_replace("`", "", $m[1])."'";
}, trim($sql)
);
}
$is_debug = get_permission_debug_show();
$start_time = $is_debug ? get_microtime() : 0;