From 07a23d7f0b5ce0fb52760533024c3cdb762f6613 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Wed, 1 Jun 2022 21:05:08 +0200 Subject: [PATCH] addressing deprecation warnings in php 8.1 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in lib/Data/Database.php on line 280 & 555 --- lib/Data/Database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Data/Database.php b/lib/Data/Database.php index 2aa3ecd..f9a8ae8 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -277,9 +277,9 @@ class Database extends AbstractData } // support v1 attachments - if (array_key_exists('attachment', $paste) && strlen($paste['attachment'])) { + if (array_key_exists('attachment', $paste) && !empty($paste['attachment'])) { self::$_cache[$pasteid]['attachment'] = $paste['attachment']; - if (array_key_exists('attachmentname', $paste) && strlen($paste['attachmentname'])) { + if (array_key_exists('attachmentname', $paste) && !empty($paste['attachmentname'])) { self::$_cache[$pasteid]['attachmentname'] = $paste['attachmentname']; } } @@ -552,7 +552,7 @@ class Database extends AbstractData $position = $key + 1; if (is_int($parameter)) { $statement->bindParam($position, $parameter, PDO::PARAM_INT); - } elseif (strlen($parameter) >= 4000) { + } elseif (is_string($parameter) && strlen($parameter) >= 4000) { $statement->bindParam($position, $parameter, PDO::PARAM_STR, strlen($parameter)); } else { $statement->bindParam($position, $parameter);