From 4926a44ecc51af3291083248b2a50fe567c1699d Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 22 Nov 2022 13:34:17 +0900 Subject: [PATCH] Fix warnings when executing unusual queries --- common/framework/db.php | 12 ++++++++++-- common/framework/parsers/dbquery/variablebase.php | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/framework/db.php b/common/framework/db.php index 20907ed92..b1690fc72 100644 --- a/common/framework/db.php +++ b/common/framework/db.php @@ -1193,8 +1193,16 @@ class DB $result['called_file'] = $backtrace[$no]['file']; $result['called_line'] = $backtrace[$no]['line']; $no++; - $result['called_method'] = $backtrace[$no]['class'] . $backtrace[$no]['type'] . $backtrace[$no]['function']; - $result['backtrace'] = array_slice($backtrace, $no, 1); + if (isset($backtrace[$no])) + { + $result['called_method'] = $backtrace[$no]['class'] . $backtrace[$no]['type'] . $backtrace[$no]['function']; + $result['backtrace'] = array_slice($backtrace, $no, 1); + } + else + { + $result['called_method'] = ''; + $result['backtrace'] = []; + } break; } } diff --git a/common/framework/parsers/dbquery/variablebase.php b/common/framework/parsers/dbquery/variablebase.php index 6089ee40b..7dc3e1a3c 100644 --- a/common/framework/parsers/dbquery/variablebase.php +++ b/common/framework/parsers/dbquery/variablebase.php @@ -89,7 +89,7 @@ class VariableBase } elseif ($this->not_null) { - throw new \Rhymix\Framework\Exceptions\QueryError('Variable ' . $this->var . ' for column ' . $this->column . ' is not set'); + throw new \Rhymix\Framework\Exceptions\QueryError('Variable ' . $this->var . ' for column ' . ($this->column ?? 'unknown') . ' is not set'); } elseif (!in_array($this->operation, ['null', 'notnull', 'not_null'])) {