From a273b2c957ffd566f4658693b2ee2fb2121bdf57 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Thu, 17 Mar 2022 12:17:38 +0100 Subject: [PATCH 1/4] Fix notice with PHP8 Error `PHP Warning: Undefined array key "host" in /var/www/html/app/site/public/typo3conf/ext/powermail/Classes/Utility/FrontendUtility.php line 193` --- Classes/Utility/FrontendUtility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Utility/FrontendUtility.php b/Classes/Utility/FrontendUtility.php index 8cb501d81..11ccaa40d 100644 --- a/Classes/Utility/FrontendUtility.php +++ b/Classes/Utility/FrontendUtility.php @@ -188,7 +188,7 @@ public static function getPropertyFromLoggedInFrontendUser(string $propertyName public static function getDomainFromUri(string $uri): string { $uriParts = parse_url($uri); - return (string)$uriParts['host']; + return (string)($uriParts['host'] ?? ''); } /** From e0fb0c87c14cb4d456b4ce5aef2bbfcc5d519ea4 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Thu, 17 Mar 2022 15:12:04 +0100 Subject: [PATCH 2/4] [BUGFIX] Fix notice in ShowFormNoteEditForm With PHP8 the following notice is thrown: ``` PHP Warning: Trying to access array offset on value of type int in /var/www/html/app/site/public/typo3conf/ext/powermail/Classes/Tca/ShowFormNoteEditForm.php line 224 ``` the language uid is in `$this->data['databaseRow']['sys_language_uid']` but as sometimes it is an array and sometimes it is not I suggest the proposed solution to check all --- Classes/Tca/ShowFormNoteEditForm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/Tca/ShowFormNoteEditForm.php b/Classes/Tca/ShowFormNoteEditForm.php index 67604e4ba..bd5e5f936 100644 --- a/Classes/Tca/ShowFormNoteEditForm.php +++ b/Classes/Tca/ShowFormNoteEditForm.php @@ -219,7 +219,8 @@ protected function getRelatedFormUid(): int { $flexFormArray = (array)$this->data['databaseRow']['pi_flexform']['data']['main']['lDEF']; $formUid = (int)$flexFormArray['settings.flexform.main.form']['vDEF'][0]; - $formUid = $this->getLocalizedFormUid($formUid, (int)$this->data['databaseRow']['sys_language_uid'][0]); + $language = (int)($this->data['databaseRow']['sys_language_uid'][0] ?? $this->data['databaseRow']['sys_language_uid'] ?? 0); + $formUid = $this->getLocalizedFormUid($formUid, $language); return $formUid; } From 5cbe571654bf4f87dcbdfc6ba782a626faa2eded Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Thu, 17 Mar 2022 17:35:23 +0100 Subject: [PATCH 3/4] [BUGFIX] Fix notices in ReceiverMailReceiverPropertiesService Fix lots of notices to make it possible to actually send a mail --- .../Mail/ReceiverMailReceiverPropertiesService.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/Domain/Service/Mail/ReceiverMailReceiverPropertiesService.php b/Classes/Domain/Service/Mail/ReceiverMailReceiverPropertiesService.php index 6097cde30..5ff8b573b 100644 --- a/Classes/Domain/Service/Mail/ReceiverMailReceiverPropertiesService.php +++ b/Classes/Domain/Service/Mail/ReceiverMailReceiverPropertiesService.php @@ -118,11 +118,11 @@ public function getReceiverName(): string protected function setReceiverEmails(): void { $emailArray = $this->getEmailsFromFlexForm(); - $emailArray = $this->getEmailsFromFeGroup($emailArray, (int)$this->settings['receiver']['fe_group']); - $emailArray = $this->getEmailsFromBeGroup($emailArray, (int)$this->settings['receiver']['be_group']); + $emailArray = $this->getEmailsFromFeGroup($emailArray, (int)($this->settings['receiver']['fe_group'] ?? 0)); + $emailArray = $this->getEmailsFromBeGroup($emailArray, (int)($this->settings['receiver']['be_group'] ?? 0)); $emailArray = $this->getEmailsFromPredefinedEmail( $emailArray, - (string)$this->settings['receiver']['predefinedemail'] + (string)($this->settings['receiver']['predefinedemail'] ?? '') ); $emailArray = $this->overWriteEmailsWithTypoScript($emailArray); $emailArray = $this->getEmailFromDevelopmentContext($emailArray); @@ -140,7 +140,7 @@ protected function setReceiverEmails(): void */ protected function getEmailsFromFlexForm(): array { - if ((int)$this->settings['receiver']['type'] === self::RECEIVERS_DEFAULT) { + if ((int)($this->settings['receiver']['type'] ?? 0) === self::RECEIVERS_DEFAULT) { $mailRepository = ObjectUtility::getObjectManager()->get(MailRepository::class); $emailString = TemplateUtility::fluidParseString( $this->settings['receiver']['email'], @@ -161,7 +161,7 @@ protected function getEmailsFromFlexForm(): array */ protected function getEmailsFromFeGroup(array $emailArray, int $uid): array { - if ((int)$this->settings['receiver']['type'] === self::RECEIVERS_FRONTENDGROUP && !empty($uid)) { + if ((int)($this->settings['receiver']['type'] ?? 0) === self::RECEIVERS_FRONTENDGROUP && !empty($uid)) { $userRepository = ObjectUtility::getObjectManager()->get(UserRepository::class); $users = $userRepository->findByUsergroup($uid); $emailArray = []; @@ -186,7 +186,7 @@ protected function getEmailsFromFeGroup(array $emailArray, int $uid): array */ protected function getEmailsFromBeGroup(array $emailArray, int $uid): array { - if ((int)$this->settings['receiver']['type'] === self::RECEIVERS_BACKENDGROUP && !empty($uid)) { + if ((int)($this->settings['receiver']['type'] ?? 0) === self::RECEIVERS_BACKENDGROUP && !empty($uid)) { /** @var BackendUserRepository $beUserRepository */ $beUserRepository = ObjectUtility::getObjectManager()->get(BackendUserRepository::class); $query = $beUserRepository->createQuery(); @@ -217,7 +217,7 @@ protected function getEmailsFromBeGroup(array $emailArray, int $uid): array */ protected function getEmailsFromPredefinedEmail(array $emailArray, string $predefinedString): array { - if ((int)$this->settings['receiver']['type'] === self::RECEIVERS_PREDEFINED && !empty($predefinedString)) { + if ((int)($this->settings['receiver']['type'] ?? 0) === self::RECEIVERS_PREDEFINED && !empty($predefinedString)) { $receiverString = TypoScriptUtility::overwriteValueFromTypoScript( '', $this->configuration['receiver.']['predefinedReceiver.'][$predefinedString . '.'], From 4efa87ff05c00fa2687f39b68232f7686cee1aeb Mon Sep 17 00:00:00 2001 From: Marcus Schwemer Date: Fri, 18 Mar 2022 10:25:00 +0100 Subject: [PATCH 4/4] [TASK] Release preparations for 9.0.2 Fix many php8 notices Signed-off-by: Marcus Schwemer --- ext_emconf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_emconf.php b/ext_emconf.php index 5669d4d4b..c612970f3 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -9,7 +9,7 @@ and easy to use mailform extension with a lots of features (spam prevention, marketing information, optin, ajax submit, diagram analysis, etc...)', 'category' => 'plugin', - 'version' => '9.0.1', + 'version' => '9.0.2', 'state' => 'beta', 'author' => 'Powermail Development Team', 'author_email' => 'service@in2code.de',