From 76f51a1ffbbf430354715822521caaf9f4caa815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 21 Aug 2017 11:20:24 +0200 Subject: [PATCH 1/2] Use tryQuery instead of query to handle errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We really do not want to end up in mysql_die here as we could have sent some output already. Fixes #13600 Signed-off-by: Michal Čihař --- libraries/plugins/export/ExportSql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/plugins/export/ExportSql.php b/libraries/plugins/export/ExportSql.php index 07cc9c7401..2efe373eec 100644 --- a/libraries/plugins/export/ExportSql.php +++ b/libraries/plugins/export/ExportSql.php @@ -1387,7 +1387,7 @@ class ExportSql extends ExportPlugin // need to use PMA\libraries\DatabaseInterface::QUERY_STORE // with $GLOBALS['dbi']->numRows() in mysqli - $result = $GLOBALS['dbi']->query( + $result = $GLOBALS['dbi']->tryQuery( 'SHOW TABLE STATUS FROM ' . Util::backquote($db) . ' WHERE Name = \'' . $GLOBALS['dbi']->escapeString($table) . '\'', null, From 3c79eb6cdbc88d64a91f8be621bb69f27c4b4c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 21 Aug 2017 11:23:55 +0200 Subject: [PATCH 2/2] Better handle situation where debug_backtrace is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #13599 Signed-off-by: Michal Čihař --- libraries/Error.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libraries/Error.php b/libraries/Error.php index 879be92c64..5901c0746c 100644 --- a/libraries/Error.php +++ b/libraries/Error.php @@ -103,10 +103,15 @@ class Error extends Message $this->setFile($errfile); $this->setLine($errline); - $backtrace = debug_backtrace(); - // remove last three calls: - // debug_backtrace(), handleError() and addError() - $backtrace = array_slice($backtrace, 3); + // This function can be disabled in php.ini + if (function_exists('debug_backtrace')) { + $backtrace = @debug_backtrace(); + // remove last three calls: + // debug_backtrace(), handleError() and addError() + $backtrace = array_slice($backtrace, 3); + } else { + $backtrace = array(); + } $this->setBacktrace($backtrace); }