in2code-de / powermail

This is the official repository of the TYPO3 extension powermail! Powermail is a well-known, editor-friendly, powerful and easy mailform extension for TYPO3
https://in2code.de
88 stars 174 forks source link

Section "main" does not exist #974

Closed weblution closed 8 months ago

weblution commented 8 months ago

With following TYPO3 installation:

I sometimes get following exception when submitting a form and then no mails are sent:

Section "main" does not exist.

Deleting the line introduced with following commit solves the problem: https://github.com/in2code-de/powermail/commit/d7fbf5db9750eb48dc82b3b74173b9e42a2daf36

nabossha commented 8 months ago

i have exactly the same issue, was actually writing on the issue in parallel. I could observe this behaviour especially (but not limited to) the case that it always happens after i have cleared all caches. The first form-submission after clearing caches always fails with [CRITICAL] request="97608a3b15eae" component="TYPO3.CMS.Core.Error.DebugExceptionHandler": Core: Exception handler (WEB: FE): TYPO3Fluid\Fluid\View\Exception\InvalidSectionException, code #0, file /var/www/html/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php, line 266: Section "main" does not exist.- InvalidSectionException: Section "main" does not exist.

after that, some form-submissions work, others do not and it looks completely random to me as it happens on different forms on different pages.

TYPO3 12.4.11 Powermail 12.1.1 PHP 8.2 (DDEV)

my patch looks actually different, i changed line 71 in VariablesViewHelper.php to return html_entity_decode($parseObject->render() ?? '', ENT_QUOTES, 'UTF-8');

nabossha commented 8 months ago

i extensively tested this again on 2 different projects, both using the following base:

interestingly on Project A i have no issues whatsoever with the functionality of Powermail: senderMail and receiverMail get sent out and can be checked in mailpit.

i then stripped down my project which has problems sending out mails COMPLETELY to the point where the installed Extensions matched exactly with Project A. still, after clearing all caches, deleting all cache-folders I was not able to send out receiverMails from Powermail - senderMails get sent out and the Email-Content looks fine (HTML) BUT the body from mail-record which is accessible in the Backend strangely looks like this:

[

'anrede' => 'Herr',
'nachname' => 'Muster',
'vorname' => 'Max',
'strassenr' => irgendwas',
'e_mail' => 'mymail@domain.org',
]

There is NO receiverMail sent out and strangely it takes a veeery long time in the frontend after the senderMail is processed until i get a Gateway-Timeout from my DDEV-server. It seems like passing the renderingCOntext to the recieverMail seems to mess something up but i cannot narrow down the problem.

I am able to fix the problem by applying @weblution 's fix to https://github.com/in2code-de/powermail/blob/707d7bc8123db8a097254783bb471805b6cd7412/Classes/ViewHelpers/Misc/VariablesViewHelper.php#L62

I tried also the following approaches, but was unable to get Powermail working:

Any help on this would be appreciated - will be glad to provide more information if needed.

ddoronenko commented 8 months ago

I have the same issue.

Section "main" does not exist.

Deleting the line introduced with following commit solves the problem: https://github.com/in2code-de/powermail/commit/d7fbf5db9750eb48dc82b3b74173b9e42a2daf36

TYPO3 12.4.11 Powermail 12.1.1 PHP 8.2

weblution commented 8 months ago

As a temporary workaround for TYPO3 12.4.11 I now use

"in2code/powermail": "12.0.*",
"symfony/expression-language" : "^6.4",
mschwemer commented 8 months ago

Thanks for your report and tests.

It's fixed in version 12.2.0