From f290aeee63eb27310b71533ca497e74a08401f31 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:22:58 +0000 Subject: [PATCH 1/7] Small bugfix to not validate the Slave when it's not enabled --- include/classes/mysqlims.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index b4537610..26d02e57 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -6,6 +6,7 @@ class mysqlims extends mysqli { private $mysqliW; private $mysqliR = null; + private $slave = false; /* * Pass main and slave connection arrays to the constructor, and strict as true/false @@ -27,6 +28,7 @@ class mysqlims extends mysqli $this->mysqliR = new mysqli_strict($slave['host'], $slave['user'], $slave['pass'], $slave['name'], $slave['port']); + $this->slave = true; } } else { $this->mysqliW = new mysqli($main['host'], @@ -37,6 +39,7 @@ class mysqlims extends mysqli $this->mysqliR = new mysqli($slave['host'], $slave['user'], $slave['pass'], $slave['name'], $slave['port']); + $this->slave = true; } } @@ -44,7 +47,7 @@ class mysqlims extends mysqli throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); } - if ($this->mysqliR->connect_errno) { + if ($this->mysqliR->connect_errno && $this->slave === true) { throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error); } } From 7929ac79abbd650f6165e1361b844cad9ac9c705 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:34:15 +0000 Subject: [PATCH 2/7] Same as previous --- include/classes/mysqlims.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 26d02e57..85042774 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -60,7 +60,7 @@ class mysqlims extends mysqli */ public function prepare($query) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->mysqliR !== null) { + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { return $this->mysqliW->prepare($query); From 142261d4e0eee9545e97235ad74ed9b6a5a27a4e Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:34:53 +0000 Subject: [PATCH 3/7] Same as previous... damn hangover --- include/classes/mysqlims.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 85042774..3c5d9ba7 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -77,7 +77,7 @@ class mysqlims extends mysqli */ public function query($query, $resultmode = MYSQLI_STORE_RESULT) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->mysqliR !== null) {/* Use readonly server */ + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */ return $this->mysqliR->query($query, $resultmode); } else { return $this->mysqliW->query($query, $resultmode); From c5ca7a83b2152cc35e9dce86b8f796dc5d24e1fc Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:46:30 +0000 Subject: [PATCH 4/7] Modified slave validation .gitignore composer.lock, and remove composer.lock from repo --- .gitignore | 2 +- composer.lock | 1358 ---------------------------- include/classes/mysqlims.class.php | 3 +- 3 files changed, 3 insertions(+), 1360 deletions(-) delete mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 5986fa6f..0770ff41 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,4 @@ tests/_output/* /nbproject/* # No need for composer.lock -composer.lock \ No newline at end of file +/composer.lock \ No newline at end of file diff --git a/composer.lock b/composer.lock deleted file mode 100644 index a66396f0..00000000 --- a/composer.lock +++ /dev/null @@ -1,1358 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "f4064453293d9402e55a6a6ec40b58cb", - "packages": [], - "packages-dev": [ - { - "name": "codeception/codeception", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/Codeception/Codeception.git", - "reference": "07511243c22ab1229047cda593bc6b29fb4511a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/07511243c22ab1229047cda593bc6b29fb4511a4", - "reference": "07511243c22ab1229047cda593bc6b29fb4511a4", - "shasum": "" - }, - "require": { - "facebook/webdriver": "~0.4", - "guzzlehttp/guzzle": "4.*", - "php": ">=5.4.0", - "phpunit/phpunit": "~4.0", - "symfony/browser-kit": "~2.4", - "symfony/console": "~2.4", - "symfony/css-selector": "~2.4", - "symfony/dom-crawler": "~2.4,!=2.4.5", - "symfony/event-dispatcher": "~2.4", - "symfony/finder": "~2.4", - "symfony/yaml": "~2.4" - }, - "require-dev": { - "facebook/php-sdk": "3.*", - "monolog/monolog": "*", - "videlalvaro/php-amqplib": "*" - }, - "suggest": { - "codeception/phpbuiltinserver": "Extension to start and stop PHP built-in web server for your tests", - "codeception/specify": "BDD-style code blocks", - "codeception/verify": "BDD-style assertions", - "monolog/monolog": "Log test steps" - }, - "bin": [ - "codecept" - ], - "type": "library", - "autoload": { - "psr-0": { - "Codeception": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Bodnarchuk", - "email": "davert@mail.ua", - "homepage": "http://codegyre.com" - } - ], - "description": "BDD-style testing framework", - "homepage": "http://codeception.com/", - "keywords": [ - "BDD", - "TDD", - "acceptance testing", - "functional testing", - "unit testing" - ], - "time": "2014-06-21 01:03:08" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2014-10-13 12:58:55" - }, - { - "name": "facebook/webdriver", - "version": "v0.5.1", - "source": { - "type": "git", - "url": "https://github.com/facebook/php-webdriver.git", - "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/bbcb697efb394d17bd9ec3d467e7da847cde4509", - "reference": "bbcb697efb394d17bd9ec3d467e7da847cde4509", - "shasum": "" - }, - "require": { - "php": ">=5.3.19" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "2.*", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "lib/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "A php client for WebDriver", - "homepage": "https://github.com/facebook/php-webdriver", - "keywords": [ - "facebook", - "php", - "selenium", - "webdriver" - ], - "time": "2014-11-05 20:53:09" - }, - { - "name": "guzzlehttp/guzzle", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "66fd916e9f9130bc22c51450476823391cb2f67c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd916e9f9130bc22c51450476823391cb2f67c", - "reference": "66fd916e9f9130bc22c51450476823391cb2f67c", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/streams": "~2.1", - "php": ">=5.4.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0", - "psr/log": "~1.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2014-10-05 19:29:14" - }, - { - "name": "guzzlehttp/streams", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/f91b721d73f0e561410903b3b3c90a5d0e40b534", - "reference": "f91b721d73f0e561410903b3b3c90a5d0e40b534", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data (Guzzle 4+)", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "time": "2014-08-17 21:15:53" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.0.13", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.1" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2014-12-03 06:41:44" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "File/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2013-10-10 15:34:57" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "Text/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2014-01-30 17:20:04" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2013-08-02 07:42:54" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2014-08-31 06:12:13" - }, - { - "name": "phpunit/phpunit", - "version": "4.4.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", - "reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.2", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.1", - "sebastian/exporter": "~1.0", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2014-12-05 06:49:03" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "c63d2367247365f688544f0d500af90a11a44c65" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", - "reference": "c63d2367247365f688544f0d500af90a11a44c65", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "~1.0,>=1.0.1", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.3" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2014-10-03 05:12:11" - }, - { - "name": "sebastian/comparator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.1", - "sebastian/exporter": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2014-11-16 21:32:38" - }, - { - "name": "sebastian/diff", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2014-08-15 10:29:00" - }, - { - "name": "sebastian/environment", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2014-10-25 08:00:45" - }, - { - "name": "sebastian/exporter", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2014-09-10 00:51:36" - }, - { - "name": "sebastian/global-state", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2014-10-06 09:23:50" - }, - { - "name": "sebastian/version", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" - }, - { - "name": "symfony/browser-kit", - "version": "v2.6.1", - "target-dir": "Symfony/Component/BrowserKit", - "source": { - "type": "git", - "url": "https://github.com/symfony/BrowserKit.git", - "reference": "421feda1413fbd09f15d9e7ce39790239d7e01e7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/421feda1413fbd09f15d9e7ce39790239d7e01e7", - "reference": "421feda1413fbd09f15d9e7ce39790239d7e01e7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/dom-crawler": "~2.0" - }, - "require-dev": { - "symfony/css-selector": "~2.0", - "symfony/process": "~2.0" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\BrowserKit\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony BrowserKit Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/console", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/ef825fd9f809d275926547c9e57cbf14968793e8", - "reference": "ef825fd9f809d275926547c9e57cbf14968793e8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1", - "symfony/process": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/css-selector", - "version": "v2.6.1", - "target-dir": "Symfony/Component/CssSelector", - "source": { - "type": "git", - "url": "https://github.com/symfony/CssSelector.git", - "reference": "93eb315b545b60a908271762fb4bfa1f9954b851" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/CssSelector/zipball/93eb315b545b60a908271762fb4bfa1f9954b851", - "reference": "93eb315b545b60a908271762fb4bfa1f9954b851", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\CssSelector\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/dom-crawler", - "version": "v2.6.1", - "target-dir": "Symfony/Component/DomCrawler", - "source": { - "type": "git", - "url": "https://github.com/symfony/DomCrawler.git", - "reference": "300d449f79d74ac62b06edd05214e8dd2e635840" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/300d449f79d74ac62b06edd05214e8dd2e635840", - "reference": "300d449f79d74ac62b06edd05214e8dd2e635840", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/css-selector": "~2.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\DomCrawler\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.6.1", - "target-dir": "Symfony/Component/EventDispatcher", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/720fe9bca893df7ad1b4546649473b5afddf0216", - "reference": "720fe9bca893df7ad1b4546649473b5afddf0216", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.6", - "symfony/expression-language": "~2.6", - "symfony/stopwatch": "~2.2" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/finder", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", - "reference": "0d3ef7f6ec55a7af5eca7914eaa0dacc04ccc721", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/yaml", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Yaml", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 3c5d9ba7..f59ad42b 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -47,7 +47,7 @@ class mysqlims extends mysqli throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); } - if ($this->mysqliR->connect_errno && $this->slave === true) { + if ($this->slave === true && $this->mysqliR->connect_errno) { throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error); } } @@ -60,6 +60,7 @@ class mysqlims extends mysqli */ public function prepare($query) { + mysqli::prepare($query); if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { From c27db96f05c1185872a57f625b0788f519052e0a Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:48:14 +0000 Subject: [PATCH 5/7] removed trash --- include/classes/mysqlims.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index f59ad42b..9a1927f7 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -60,7 +60,6 @@ class mysqlims extends mysqli */ public function prepare($query) { - mysqli::prepare($query); if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { return $this->mysqliR->prepare($query); } else { From 12cee6e25a3113fc3582201fba4b95d0f37ebaf1 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Mon, 11 Dec 2017 02:05:26 +0000 Subject: [PATCH 6/7] There was a bug here, whereas the query is perfectly fine, but instead of returning false it was returning the this->sqlError.... which by then was returning the return false, the problem was the log in the cron that was misleading, took 2 days figuring this one out --- include/classes/notification.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/classes/notification.class.php b/include/classes/notification.class.php index c1807dd9..396072c6 100644 --- a/include/classes/notification.class.php +++ b/include/classes/notification.class.php @@ -23,8 +23,16 @@ class Notification extends Mail { $data = json_encode($aData); $stmt = $this->mysqli->prepare("SELECT id FROM $this->table WHERE data = ? AND active = 1 LIMIT 1"); if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1) - return true; - return $this->sqlError('E0041'); + { + return true; + } + + if( $stmt->errno ) + { + return $this->sqlError(); + } + + return false; } /** From d259610ac57669174733777b64c3529f603bb809 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Mon, 11 Dec 2017 03:30:56 +0000 Subject: [PATCH 7/7] Properly fixed possible MySQL Errors, will test in prod for 1 day Had to rewrite all the mysqli->error/errno to mysqli->lastused because of the read/write splitting, shoud be working now Reverted notifications code back to previous version Added the lastused property to mysqlms, so that when calling the error/errno we know what was the lsat connection used, same for insert_id --- include/classes/base.class.php | 5 +++-- include/classes/mysqlims.class.php | 7 ++++++- include/classes/notification.class.php | 10 ++-------- include/classes/template.class.php | 6 +++--- include/classes/user.class.php | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/classes/base.class.php b/include/classes/base.class.php index c29534b2..30d0753c 100644 --- a/include/classes/base.class.php +++ b/include/classes/base.class.php @@ -253,8 +253,9 @@ class Base { $this->setErrorMessage(call_user_func_array(array($this, 'getErrorMsg'), func_get_args())); } // Default to SQL error for debug and cron errors - $this->debug->append($this->getErrorMsg('E0019', $this->mysqli->error)); - $this->setCronMessage($this->getErrorMsg('E0019', $this->mysqli->error)); + $this->debug->append($this->getErrorMsg('E0019', $this->mysqli->lastused->errno)); + $this->setCronMessage($this->getErrorMsg('E0019', $this->mysqli->lastused->errno)); + return false; } diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 9a1927f7..98ec503e 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -7,7 +7,8 @@ class mysqlims extends mysqli private $mysqliW; private $mysqliR = null; private $slave = false; - + public $lastused = null; + /* * Pass main and slave connection arrays to the constructor, and strict as true/false * @@ -61,8 +62,10 @@ class mysqlims extends mysqli public function prepare($query) { if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { + $this->lastused = $this->mysqliR; return $this->mysqliR->prepare($query); } else { + $this->lastused = $this->mysqliW; return $this->mysqliW->prepare($query); } } @@ -78,8 +81,10 @@ class mysqlims extends mysqli public function query($query, $resultmode = MYSQLI_STORE_RESULT) { if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */ + $this->lastused = $this->mysqliR; return $this->mysqliR->query($query, $resultmode); } else { + $this->lastused = $this->mysqliW; return $this->mysqliW->query($query, $resultmode); } } diff --git a/include/classes/notification.class.php b/include/classes/notification.class.php index 396072c6..48c64e37 100644 --- a/include/classes/notification.class.php +++ b/include/classes/notification.class.php @@ -22,17 +22,11 @@ class Notification extends Mail { $this->debug->append("STA " . __METHOD__, 4); $data = json_encode($aData); $stmt = $this->mysqli->prepare("SELECT id FROM $this->table WHERE data = ? AND active = 1 LIMIT 1"); - if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1) - { + if ($stmt && $stmt->bind_param('s', $data) && $stmt->execute() && $stmt->store_result() && $stmt->num_rows == 1) { return true; } - - if( $stmt->errno ) - { - return $this->sqlError(); - } - return false; + return $this->sqlError('E0041'); } /** diff --git a/include/classes/template.class.php b/include/classes/template.class.php index dac32fdd..295243f5 100644 --- a/include/classes/template.class.php +++ b/include/classes/template.class.php @@ -79,7 +79,7 @@ class Template extends Base { } $this->setErrorMessage('Failed to get active templates'); - $this->debug->append('Template::getActiveTemplates failed: ' . $this->mysqli->error); + $this->debug->append('Template::getActiveTemplates failed: ' . $this->mysqli->lastused->error); return false; } @@ -172,7 +172,7 @@ class Template extends Base { return $result->fetch_assoc(); $this->setErrorMessage('Failed to get the template'); - $this->debug->append('Template::getEntry failed: ' . $this->mysqli->error); + $this->debug->append('Template::getEntry failed: ' . $this->mysqli->lastused->error); return false; } @@ -206,7 +206,7 @@ class Template extends Base { return true; $this->setErrorMessage('Database error'); - $this->debug->append('Template::updateEntry failed: ' . $this->mysqli->error); + $this->debug->append('Template::updateEntry failed: ' . $this->mysqli->lastused->error); return false; } } diff --git a/include/classes/user.class.php b/include/classes/user.class.php index 8af175d3..77a5507e 100644 --- a/include/classes/user.class.php +++ b/include/classes/user.class.php @@ -575,7 +575,7 @@ class User extends Base { } // Catchall $this->setErrorMessage('Failed to update your account'); - $this->debug->append('Account update failed: ' . $this->mysqli->error); + $this->debug->append('Account update failed: ' . $this->mysqli->lastused->error); return false; } @@ -832,7 +832,7 @@ class User extends Base { $signup_time = time(); if ($this->checkStmt($stmt) && $stmt->bind_param('sssissi', $username_clean, $password_hash, $email1, $signup_time, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) { - $new_account_id = $this->mysqli->insert_id; + $new_account_id = $this->mysqli->lastused->insert_id; if (!is_null($coinaddress)) $this->coin_address->add($new_account_id, $coinaddress); if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { @@ -855,8 +855,8 @@ class User extends Base { } } else { $this->setErrorMessage( 'Unable to register' ); - $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->error); - echo $this->mysqli->error; + $this->debug->append('Failed to insert user into DB: ' . $this->mysqli->lastused->error); + echo $this->mysqli->lastused->error; if ($stmt->sqlstate == '23000') $this->setErrorMessage( 'Username or email already registered' ); return false; } @@ -895,7 +895,7 @@ class User extends Base { } else { $this->setErrorMessage('Invalid token: ' . $this->token->getError()); } - $this->debug->append('Failed to update password:' . $this->mysqli->error); + $this->debug->append('Failed to update password:' . $this->mysqli->lastused->error); return false; }