summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDamien Regad <dregad@mantisbt.org>2023-04-16 15:29:54 +0200
committerDamien Regad <dregad@mantisbt.org>2023-04-16 15:34:29 +0200
commitb881dea297a93496fbd6d1d8a3c2fbe277c9231c (patch)
tree9d74a25824e5441ac7f8e91511315acaa55be327 /drivers
parent059ffc2eeac134f293ac7e729672cc452137914a (diff)
downloadadodb-b881dea297a93496fbd6d1d8a3c2fbe277c9231c.tar.gz
adodb-b881dea297a93496fbd6d1d8a3c2fbe277c9231c.tar.bz2
adodb-b881dea297a93496fbd6d1d8a3c2fbe277c9231c.zip
Fix deprecated warning in ADODB_postgres64::qStr()
pg_escape_string() will trigger a deprecation warning in PHP 8.1+ when there is no connection specified. This can occur when using setSessionVariables() in the load balancer, so we fall back to emulated escaping in this case. Fixes #956
Diffstat (limited to 'drivers')
-rw-r--r--drivers/adodb-postgres64.inc.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php
index fa8e5fba..23a21958 100644
--- a/drivers/adodb-postgres64.inc.php
+++ b/drivers/adodb-postgres64.inc.php
@@ -258,7 +258,9 @@ class ADODB_postgres64 extends ADOConnection{
if ($this->_connectionID) {
return "'" . pg_escape_string($this->_connectionID, $s) . "'";
} else {
- return "'" . pg_escape_string($s) . "'";
+ // Fall back to emulated escaping when there is no database connection.
+ // Avoids errors when using setSessionVariables() in the load balancer.
+ return parent::qStr( $s );
}
}