powermail
powermail copied to clipboard
Return value type is too hard (strict): FrontendUtility#getPropertyFromLoggedInFrontendUser(string $propertyName = 'uid')
The method
\In2code\Powermail\Utility\FrontendUtility#getPropertyFromLoggedInFrontendUser(string $propertyName = 'uid')
want retrun a "String", but the a uid is an Integer.
My send form generates an exception:
(1/1) TypeError
Return value of In2code\Powermail\Utility\FrontendUtility::getPropertyFromLoggedInFrontendUser() must be of the type string, int returned
in /var/www/public/demo.cylancer.net/htdocs/typo3conf/ext/powermail/Classes/Utility/FrontendUtility.php line 171
public static function getPropertyFromLoggedInFrontendUser(string $propertyName = 'uid'): string
{
$tsfe = ObjectUtility::getTyposcriptFrontendController();
if (!empty($tsfe->fe_user->user[$propertyName])) {
return $tsfe->fe_user->user[$propertyName];
}
return '';
}
at In2code\Powermail\Utility\FrontendUtility::getPropertyFromLoggedInFrontendUser('uid')
in /var/www/public/demo.cylancer.net/htdocs/typo3conf/ext/powermail/Classes/Domain/Factory/MailFactory.php line 73
protected function setFeuser(Mail $mail): void
{
if (FrontendUtility::isLoggedInFrontendUser()) {
$userRepository = ObjectUtility::getObjectManager()->get(UserRepository::class);
$mail->setFeuser($userRepository->findByUid(FrontendUtility::getPropertyFromLoggedInFrontendUser('uid')));
}
}
/**
at In2code\Powermail\Domain\Factory\MailFactory->setFeuser(object(In2code\Powermail\Domain\Model\Mail))
in /var/www/public/demo.cylancer.net/htdocs/typo3conf/ext/powermail/Classes/Domain/Factory/MailFactory.php line 58
->setMarketingFrontendLanguage($marketingInfos['frontendLanguage'])
->setMarketingBrowserLanguage($marketingInfos['browserLanguage'])
->setMarketingPageFunnel($marketingInfos['pageFunnel']);
$mail->setPid(FrontendUtility::getStoragePage((int)$settings['main']['pid']));
$this->setFeuser($mail);
$this->setSenderIp($mail);
$this->setHidden($mail, $settings);
$this->setAnswersPid($mail, $settings);
}
Please fix it...
Thanks Clemens
This seems to be fixed in the develop branch.
https://github.com/einpraegsam/powermail/blob/develop/Classes/Utility/FrontendUtility.php#L171