Skip to content

Commit

Permalink
Fix deprecated warning in ADODB_postgres64::qStr()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dregad committed Apr 16, 2023
1 parent 059ffc2 commit b881dea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/adodb-postgres64.inc.php
Expand Up @@ -258,7 +258,9 @@ function qStr($s, $magic_quotes=false)
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 );
}
}

Expand Down

0 comments on commit b881dea

Please sign in to comment.