Better reporting of connection errors
We really do not care about traceback or parameters in this case, all we need is to display the message coming from PHP. Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
951f1fed5f
commit
cfbc31bfa6
@ -2351,10 +2351,22 @@ class DatabaseInterface
|
||||
$user, $password, $is_controluser = false, $server = null,
|
||||
$auxiliary_connection = false
|
||||
) {
|
||||
$error_count = $GLOBALS['error_handler']->countErrors();
|
||||
$result = $this->_extension->connect(
|
||||
$user, $password, $is_controluser, $server, $auxiliary_connection
|
||||
);
|
||||
|
||||
/* Any errors from connection? */
|
||||
if ($GLOBALS['error_handler']->countErrors() > $error_count) {
|
||||
$errors = $GLOBALS['error_handler']->sliceErrors($error_count);
|
||||
foreach ($errors as $error) {
|
||||
trigger_error(
|
||||
$error->getMessage(),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
if (! $auxiliary_connection && ! $is_controluser) {
|
||||
$GLOBALS['dbi']->postConnect($result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user