mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/9521] Fix error reporting for the native SQL Server plugin.
The native SQL Server plugin used to return an error string when calling sql_error. However, some error condition checks are done using is_array. This patch wraps the error into an array to follow the error logic used elsewhere. PHPBB3-9521
This commit is contained in:
parent
925a135613
commit
47557fd4d2
1 changed files with 7 additions and 1 deletions
8
phpBB/includes/db/mssqlnative.php
Normal file → Executable file
8
phpBB/includes/db/mssqlnative.php
Normal file → Executable file
|
@ -502,6 +502,7 @@ class dbal_mssqlnative extends dbal
|
|||
{
|
||||
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$error_message = '';
|
||||
$code = 0;
|
||||
|
||||
if ($errors != null)
|
||||
{
|
||||
|
@ -509,6 +510,7 @@ class dbal_mssqlnative extends dbal
|
|||
{
|
||||
$error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n";
|
||||
$error_message .= "code: ".$error[ 'code']."\n";
|
||||
$code = $error['code'];
|
||||
$error_message .= "message: ".$error[ 'message']."\n";
|
||||
}
|
||||
$this->last_error_result = $error_message;
|
||||
|
@ -518,7 +520,11 @@ class dbal_mssqlnative extends dbal
|
|||
{
|
||||
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
|
||||
}
|
||||
return $error;
|
||||
|
||||
return array(
|
||||
'message' => $error,
|
||||
'code' => $code,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue