From a24e418527283936f09483e8cfcf8902c7409cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 23 Aug 2010 17:02:15 +0200 Subject: [PATCH] Avoid PHP error when false is passed to PMA_DBI_getError. This can be caused by controllink set to false. --- libraries/dbi/mysql.dbi.lib.php | 6 ++++++ libraries/dbi/mysqli.dbi.lib.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index 4750ee225..bf1611450 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -321,6 +321,12 @@ function PMA_DBI_get_client_info() function PMA_DBI_getError($link = null) { $GLOBALS['errno'] = 0; + + /* Treat false same as null because of controllink */ + if ($link === false) { + $link = null; + } + if (null === $link && isset($GLOBALS['userlink'])) { $link =& $GLOBALS['userlink']; diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 9672385df..2c00bcdbc 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -379,6 +379,11 @@ function PMA_DBI_getError($link = null) { $GLOBALS['errno'] = 0; + /* Treat false same as null because of controllink */ + if ($link === false) { + $link = null; + } + if (null === $link && isset($GLOBALS['userlink'])) { $link =& $GLOBALS['userlink']; // Do not stop now. We still can get the error code