summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Regad <dregad@mantisbt.org>2020-01-30 10:26:13 +0100
committerDamien Regad <dregad@mantisbt.org>2020-01-30 10:40:30 +0100
commit0e813bcc8da0985559ec9e9ce7b3ba882f381d9a (patch)
tree0bf0e9193302fa8e51ab9789cedbf84737743e99
parentb3cbd53be811f8307493f387ca5831143c1925c1 (diff)
downloadadodb-0e813bcc8da0985559ec9e9ce7b3ba882f381d9a.tar.gz
adodb-0e813bcc8da0985559ec9e9ce7b3ba882f381d9a.tar.bz2
adodb-0e813bcc8da0985559ec9e9ce7b3ba882f381d9a.zip
Do not overwrite $fn function parameter
When using transactions (startTrans/completeTrans), the ADOdb Exception thrower function ($raiseErrorFn property) is replaced by a specific handler (ADODB_TransMonitor method), which itself calls the original handler (adodb_throw) by default. ADODB_TransMonitor incorrectly overwrites the $fn parameter (which drives the behavior of the ADODB_Exception class constructor) with the name of the original handler, causing ADOdb_Exception::__construct() to throw an "Array to string conversion" PHP notice when the query triggering the exception has parameters. Using a dedicated variable to store and call the original handler fixes the problem. Fixes #601
-rw-r--r--adodb.inc.php4
-rw-r--r--docs/changelog.md4
2 files changed, 6 insertions, 2 deletions
diff --git a/adodb.inc.php b/adodb.inc.php
index 74c52e00..2a7c1ca9 100644
--- a/adodb.inc.php
+++ b/adodb.inc.php
@@ -302,8 +302,8 @@ if (!defined('_ADODB_LAYER')) {
//print "Errorno ($fn errno=$errno m=$errmsg) ";
$thisConnection->_transOK = false;
if ($thisConnection->_oldRaiseFn) {
- $fn = $thisConnection->_oldRaiseFn;
- $fn($dbms, $fn, $errno, $errmsg, $p1, $p2,$thisConnection);
+ $errfn = $thisConnection->_oldRaiseFn;
+ $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2,$thisConnection);
}
}
diff --git a/docs/changelog.md b/docs/changelog.md
index 5c6774fb..5c0ab871 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -5,6 +5,10 @@ Older changelogs:
[v3.x](changelog_v3.x.md),
[v2.x](changelog_v2.x.md).
+## 5.20.17 - Unreleased
+
+- core: fix PHP notice in ADOdb_Exception constructor when using transactions. #601
+
## 5.20.16 - 12-Jan-2020
- mssql: queries are not correctly closed. #590