This is the official repository of the TYPO3 extension powermail! Powermail is a well-known, editor-friendly, powerful and easy mailform extension for TYPO3
Using Typo3 v12.4.2 and Powermail EAP 11.0.0 with composer we cannot access the backend groups editing form anymore due to the following error:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: array_keys(): Argument #1 ($array) must be of type array, null given | TypeError thrown in file /var/www/vhosts/[ANONYMIZED_URL]/vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php in line 78. Requested URL:[ANONYMIZED_URL]/typo3/record/edit?token=--AnonymizedToken--&edit%5Bbe_groups%5D%5B1%5D=edit
and
Core: Error handler (BE): PHP Warning: Undefined array key "tt_content" in /var/www/vhosts/[ANONYMIZED_URL]/vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php line 78
The solution is pretty straight forward to implement in /vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php, where the function getPidForCurrentRecord becomes:
private function getPidForCurrentRecord(): int
{
$request = $this->getRequest();
$queryParams = $request->getQueryParams();
if (isset($queryParams['edit']['tt_content'])) {
$uid = array_keys($queryParams['edit']['tt_content'])[0];
return DatabaseUtility::getPidForRecord($uid, 'tt_content');
} else if (isset($queryParams['edit']['be_groups'])) {
$uid = array_keys($queryParams['edit']['be_groups'])[0];
return DatabaseUtility::getPidForRecord($uid, 'be_groups');
}
return null;
}
To put it into words, the solution was simply to replace tt_content with the according URL parameter which equals a table in the database if it's set rather than tt_content. In my case, be_groups.
I guess there might be other places affected too, not just be_groups. It will throw an Uncaught Typo3 Exception: Return value must be of type int, null returned when that happens.
I won't create a pull request because I'm sure it's bad PHP and also that something else is going wrong that is just on our end, but I figured I might post this so if anyone encounters the same error they know right away what to do.
Hello there,
Using Typo3 v12.4.2 and Powermail EAP 11.0.0 with composer we cannot access the backend groups editing form anymore due to the following error:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: array_keys(): Argument #1 ($array) must be of type array, null given | TypeError thrown in file /var/www/vhosts/[ANONYMIZED_URL]/vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php in line 78. Requested URL:[ANONYMIZED_URL]/typo3/record/edit?token=--AnonymizedToken--&edit%5Bbe_groups%5D%5B1%5D=edit
and
Core: Error handler (BE): PHP Warning: Undefined array key "tt_content" in /var/www/vhosts/[ANONYMIZED_URL]/vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php line 78
The solution is pretty straight forward to implement in /vendor/in2code/powermail/Classes/EventListener/FlexFormParsingModifyEventListener.php, where the function getPidForCurrentRecord becomes:
To put it into words, the solution was simply to replace tt_content with the according URL parameter which equals a table in the database if it's set rather than tt_content. In my case, be_groups.
I guess there might be other places affected too, not just be_groups. It will throw an Uncaught Typo3
Exception: Return value must be of type int, null returned
when that happens.I won't create a pull request because I'm sure it's bad PHP and also that something else is going wrong that is just on our end, but I figured I might post this so if anyone encounters the same error they know right away what to do.