Permalink
Browse files

mysqli catch connection errors properly

  • Loading branch information...
1 parent 917b28c commit 1324860359e9d453204c159a7cc9076846117062 @Frug committed Nov 3, 2013
Showing with 6 additions and 2 deletions.
  1. +2 −0 .gitignore
  2. +2 −0 chat/changelog.txt
  3. +2 −2 chat/lib/class/AJAXChatMySQLiDataBase.php
View
@@ -0,0 +1,2 @@
+/chat/lib/config.php
+/nbproject/*
View
@@ -1242,13 +1242,15 @@ Bugfixes:
- Use array literal notation for javascript arrays
- Change preg_replace with /e to preg_replace_callback in AJAXChatTemplate.php - thanks to Jan Kröpke
- Fixed browser crashing bug with certain long words - thanks to Clint
+- Properly detect and report mysqli connection errors.
Changed files:
- lib/class/AJAXChat.php (all versions)
- lib/class/AJAXChatFileSystem.php (all versions)
- lib/class/AJAXChatEncoding.php (all versions)
- lib/class/AJAXChatString.php (all versions)
- lib/class/AJAXChatTemplate.php (all versions)
+- lib/class/AJAXChatMySQLiDataBase.php
- lib/lang/nl.php (all versions)
- lib/lang/nl-be.php (all versions)
- js/lang/ru.js (all versions)
@@ -22,12 +22,12 @@ function AJAXChatDataBaseMySQLi(&$dbConnectionConfig) {
// Method to connect to the DataBase server:
function connect(&$dbConnectionConfig) {
- $this->_connectionID = new mysqli(
+ @$this->_connectionID = new mysqli(
$dbConnectionConfig['host'],
$dbConnectionConfig['user'],
$dbConnectionConfig['pass']
);
- if(!$this->_connectionID) {
+ if($this->_connectionID->connect_errno) {
$this->_errno = mysqli_connect_errno();
$this->_error = mysqli_connect_error();
return false;

0 comments on commit 1324860

Please sign in to comment.