Skip to content

Commit

Permalink
[+]: "DB" -> ignore more invalid mysql warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
voku committed Aug 23, 2020
1 parent fd537c0 commit 09282c5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/voku/db/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,26 @@ private function queryWarningHandling($sql)
do {
$warningTmpStr = \print_r($warningTmp, true);
// e.g.: sql mode 'NO_AUTO_CREATE_USER' is deprecated)
if (\strpos($warningTmpStr, 'is deprecated') === false) {
if (
\strpos($warningTmpStr, 'is deprecated') !== false
&&
// MySQL throws warnings about non existing tables, also if you use "IF [NOT] EXISTS" :/
(
(
\strpos($query, 'TABLE IF EXISTS') !== false
||
\strpos($query, 'TABLE IF NOT EXISTS') !== false
)
&&
(
\strpos($warningTmpStr, 'Unknown table') !== false
||
\strpos($warningTmpStr, 'already exists') !== false
)
)
) {
// no warning
} else {
$this->queryErrorHandling(
$warningTmp->message,
$warningTmp->errno,
Expand Down

0 comments on commit 09282c5

Please sign in to comment.