summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/changelog.md10
-rw-r--r--drivers/adodb-mysqli.inc.php8
-rw-r--r--drivers/adodb-postgres7.inc.php4
3 files changed, 17 insertions, 5 deletions
diff --git a/docs/changelog.md b/docs/changelog.md
index 0b8429f8..b5dff341 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -14,6 +14,14 @@ Older changelogs:
--------------------------------------------------------------------------------
+## [Unreleased]
+
+### Fixed
+
+- mysql: TypeError when calling get/setChangeSet on unset connection (PHP 8)
+ [#686](https://github.com/ADOdb/ADOdb/issues/686)
+
+
## [5.21.0] - 2021-02-27
### Fixed
@@ -1054,6 +1062,8 @@ Released together with [v4.95](changelog_v4.x.md#495---17-may-2007)
- Adodb5 version,more error checking code now will use exceptions if available.
+[Unreleased]: https://github.com/adodb/adodb/compare/v5.21.0...hotfix/5.21
+
[5.21.0]: https://github.com/adodb/adodb/compare/v5.21.0-rc.1...v5.21.0
[5.21.0-rc.1]: https://github.com/adodb/adodb/compare/v5.21.0-beta.1...v5.21.0-rc.1
[5.21.0-beta.1]: https://github.com/adodb/adodb/compare/v5.20.20...v5.21.0-beta.1
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php
index c2415163..9c98fb9a 100644
--- a/drivers/adodb-mysqli.inc.php
+++ b/drivers/adodb-mysqli.inc.php
@@ -1175,13 +1175,13 @@ class ADODB_mysqli extends ADOConnection {
function getCharSet()
{
- //we will use ADO's builtin property charSet
- if (!method_exists($this->_connectionID,'character_set_name'))
+ if (!$this->_connectionID || !method_exists($this->_connectionID,'character_set_name')) {
return false;
+ }
$this->charSet = @$this->_connectionID->character_set_name();
if (!$this->charSet) {
- return false;
+
} else {
return $this->charSet;
}
@@ -1189,7 +1189,7 @@ class ADODB_mysqli extends ADOConnection {
function setCharSet($charset)
{
- if (!method_exists($this->_connectionID,'set_charset')) {
+ if (!$this->_connectionID || !method_exists($this->_connectionID,'set_charset')) {
return false;
}
diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php
index 2cfe694d..38762bf3 100644
--- a/drivers/adodb-postgres7.inc.php
+++ b/drivers/adodb-postgres7.inc.php
@@ -280,7 +280,9 @@ class ADODB_postgres7 extends ADODB_postgres64 {
*/
function getCharSet()
{
- //we will use ADO's builtin property charSet
+ if (!$this->_connectionID) {
+ return false;
+ }
$this->charSet = @pg_client_encoding($this->_connectionID);
if (!$this->charSet) {
return false;