diff options
| author | Damien Regad <dregad@mantisbt.org> | 2016-08-17 19:17:43 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2016-08-29 00:14:39 +0200 |
| commit | 991a6aa3d0efbbbdf2658f5e990047531b3aa254 (patch) | |
| tree | eee26554e72316554e656490051e244b96e60b77 | |
| parent | c2f054ed386c352806a5a815f4d8982b486a3153 (diff) | |
| download | adodb-991a6aa3d0efbbbdf2658f5e990047531b3aa254.tar.gz adodb-991a6aa3d0efbbbdf2658f5e990047531b3aa254.tar.bz2 adodb-991a6aa3d0efbbbdf2658f5e990047531b3aa254.zip | |
Abort with error if ADOdb Extension is detected
When the old ADOdb extension is installed and a more recent version of
ADOdb is running, a PHP warning 'undefined constant
ADODB_ASSOC_CASE_NATIVE' is thrown.
The PHP Extension is obsolete and unsupported, so we shouldn't even try
to run when it is loaded.
This commit will cause ADOdb to exit with an error (or throw an
exception if adodb-exceptions.inc.php has been included) if the
Extension is detected.
Fixes #269
| -rw-r--r-- | adodb.inc.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/adodb.inc.php b/adodb.inc.php index 821ab2ca..13711682 100644 --- a/adodb.inc.php +++ b/adodb.inc.php @@ -37,6 +37,21 @@ if (!defined('_ADODB_LAYER')) { define('_ADODB_LAYER',1); + // The ADOdb extension is no longer maintained and effectively unsupported + // since v5.04. The library will not function properly if it is present. + if(defined('ADODB_EXTENSION')) { + $msg = "Unsupported ADOdb Extension (v" . ADODB_EXTENSION . ") detected! " + . "Disable it to use ADOdb"; + + $errorfn = defined('ADODB_ERROR_HANDLER') ? ADODB_ERROR_HANDLER : false; + if ($errorfn) { + $conn = false; + $errorfn('ADOdb', basename(__FILE__), -9999, $msg, null, null, $conn); + } else { + die($msg . PHP_EOL); + } + } + //============================================================================================== // CONSTANT DEFINITIONS //============================================================================================== @@ -1142,7 +1157,7 @@ if (!defined('_ADODB_LAYER')) { ); return false; } - + // clean memory unset($element0); |
