From 05abb3f483371efa1930340379dd23fb3e3a6cb9 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Fri, 19 Aug 2022 15:04:48 +0200 Subject: [PATCH 1/4] prevent php 8 complaining about null values Fix Deprecated: SQLite3::escapeString(): Passing null to parameter #1 ($string) of type string is deprecated --- code/SQLite3Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Connector.php b/code/SQLite3Connector.php index 871294c..3c2c68f 100644 --- a/code/SQLite3Connector.php +++ b/code/SQLite3Connector.php @@ -170,7 +170,7 @@ class SQLite3Connector extends DBConnector public function escapeString($value) { - return $this->dbConn->escapeString($value); + return $this->dbConn->escapeString((string)$value); } public function selectDatabase($name) From ecaadc029e546af11bb4be60fbbf216ee76c9e39 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Fri, 19 Aug 2022 15:07:23 +0200 Subject: [PATCH 2/4] Enforce proper type Otherwise it may fail when passed to preg_match Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated --- code/SQLite3Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Connector.php b/code/SQLite3Connector.php index 3c2c68f..95fd340 100644 --- a/code/SQLite3Connector.php +++ b/code/SQLite3Connector.php @@ -48,7 +48,7 @@ class SQLite3Connector extends DBConnector public function getLastError() { $message = $this->dbConn->lastErrorMsg(); - return $message === 'not an error' ? null : $message; + return $message === 'not an error' ? '' : $message; } public function getSelectedDatabase() From d3d03d9f798013520dfb0e73db2e0bb1a7e112d7 Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Wed, 31 Aug 2022 08:58:48 +0200 Subject: [PATCH 3/4] Update code/SQLite3Connector.php Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> --- code/SQLite3Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Connector.php b/code/SQLite3Connector.php index 95fd340..ab2e8ed 100644 --- a/code/SQLite3Connector.php +++ b/code/SQLite3Connector.php @@ -170,7 +170,7 @@ class SQLite3Connector extends DBConnector public function escapeString($value) { - return $this->dbConn->escapeString((string)$value); + return $this->dbConn->escapeString($value ?? ''); } public function selectDatabase($name) From 66c1c09b74231c70699cf6af80b2174a8d17e8fa Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Wed, 31 Aug 2022 09:00:08 +0200 Subject: [PATCH 4/4] switch back to null users are expected to use ?? '' if needed --- code/SQLite3Connector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/SQLite3Connector.php b/code/SQLite3Connector.php index ab2e8ed..25efb14 100644 --- a/code/SQLite3Connector.php +++ b/code/SQLite3Connector.php @@ -48,7 +48,7 @@ class SQLite3Connector extends DBConnector public function getLastError() { $message = $this->dbConn->lastErrorMsg(); - return $message === 'not an error' ? '' : $message; + return $message === 'not an error' ? null : $message; } public function getSelectedDatabase()