Closed olivermeckel closed 4 weeks ago
Is it the missing check whether the answer is a string or an array in the templates for the SpamNotifaction?{vh:condition.isArray(val:answer.value)}
Is there a way to send/test the spamnotification log or mail by system?
I just tried to reproduce this issue with PHP 8.0 and the lastest powermail but there is no issue in my eyes:
Any hints how to reproduce it?
Hi Alex,
just to clarify: it's a php-error reported in the typo3 backend when spameshield detects an spam and send a spamnotification by mail or log using the templates plugin.tx_powermail.settings.spamshield.emailTemplate = EXT:powermail/Resources/Private/Templates/Mail/SpamNotification.html and logTemplate = EXT:powermail/Resources/Private/Templates/Log/SpamNotification.html
These template don't have a condition for value string or array
Ah, ok - I can read the error in the log:
| Core: Error handler (FE): PHP Warning: Array to string conversion in /var/www/html/powermail11.localhost.de/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 73
-- | --
I changed the code for providing the form variables ind the spam notification template for logs to:
<f:for each="{mail.answers}" as="answer">
<f:if condition="{vh:condition.isArray(val:answer.value)}">
<f:else>
- {answer.field.title}: {answer.value}
</f:else>
<f:then>
<f:for each="{answer.value}" as="subValue" iteration="index">
<f:if condition="{subValue}">
<vh:misc.manipulateValueWithTypoScript answer="{answer}" type="{type}">{subValue}</vh:misc.manipulateValueWithTypoScript><f:if condition="{index.isLast}"><f:else>, </f:else></f:if>
</f:if>
</f:for>
</f:then>
</f:if>
</f:for>
No more php-errors
By the way, Spamshield works great and detects 100% of spam requests. Great feature!
Thanks for the code snippet @olivermeckel, solved the problem for me too.
TYPO3 11.5 Powermail 10.7.3 PHP 8.1
As the comment in the last PR states, it is fixed in powermail v12.
If you need a backport to powermail v10 / TYPO3 v11 please contact in2code https://www.in2code.de/
When a contact request is detected as spam by Powermail, I get a php error message in the log:
Core: Error handler (FE): PHP Warning: Array to string conversion in /html/typo3/typo3_src-11.5.21/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 73
In addition to simple input fields, textareas, dropdowns and so on, the form also contains input fields of the type checkboxes (with multiple values). The output of multiple values in the sender and receiver mails as well as in the back end is correct. In the spam notification mail and log, the output is as text "array".
TYPO3 11.5.21 Powermail 10.7.0 PHP 8.1.12