Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing mysqli error message #1554

Merged
merged 1 commit into from

3 participants

@obsidev

Store error message and error number before calling mysqli_ping (which would clean errors)

@obsidev obsidev Fixing mysqli error message
Store error message and error number before calling mysqli_ping (which would clean errors)
91cc43a
@pasamio pasamio merged commit 1d03caa into joomla:staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2012
  1. @obsidev

    Fixing mysqli error message

    obsidev authored
    Store error message and error number before calling mysqli_ping (which would clean errors)
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 6 deletions.
  1. +3 −6 libraries/joomla/database/driver/mysqli.php
View
9 libraries/joomla/database/driver/mysqli.php
@@ -503,6 +503,9 @@ public function execute()
// If an error occurred handle it.
if (!$this->cursor)
{
+ $this->errorNum = (int) mysqli_errno($this->connection);
+ $this->errorMsg = (string) mysqli_error($this->connection) . ' SQL=' . $sql;
+
// Check if the server was disconnected.
if (!$this->connected())
{
@@ -515,9 +518,6 @@ public function execute()
// If connect fails, ignore that exception and throw the normal exception.
catch (RuntimeException $e)
{
- $this->errorNum = (int) mysqli_errno($this->connection);
- $this->errorMsg = (string) mysqli_error($this->connection) . ' SQL=' . $sql;
-
JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
throw new RuntimeException($this->errorMsg, $this->errorNum);
}
@@ -528,9 +528,6 @@ public function execute()
// The server was not disconnected.
else
{
- $this->errorNum = (int) mysqli_errno($this->connection);
- $this->errorMsg = (string) mysqli_error($this->connection) . ' SQL=' . $sql;
-
JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
throw new RuntimeException($this->errorMsg, $this->errorNum);
}
Something went wrong with that request. Please try again.