powermail
powermail copied to clipboard
Editors are not able to place a new Powermail Plug-in on any page
Issue
The Powermail Plug-in collects, while it is added to a page in TYPO3 backend, all available forms and only shows those for which the logged-in user has the necessary rights by checking if the user has access to the parent page (tx_powermail_domain_model_form.pid
). If this page does not exist in the database any more ("hard" deleted, NOT pages.deleted=1
) a wrong type is returned (false
instead of array
) and the error occurs.
How to test
- Login as a regular editor (NOT admin)
- Create a page/sys folder
- On this page/sys folder create a Powermail form
- Delete the page/sys folder but not the form in the database ("hard", means delete the complete row in the pages table)
- Try to add a Powermail Plug-in to a random page as a non-admin
Possible fix
In app/public/typo3conf/ext/powermail/Classes/Domain/Repository/PageRepository.php
change the return type of getPropertiesFromUid()
to mixed
since fetchAssociative()
can possibly return false
.
/**
* @param int $uid
- * @return array
+ * @return mixed
* @throws Exception
* @throws ExceptionDbal
*/
- public function getPropertiesFromUid(int $uid): array
+ public function getPropertiesFromUid(int $uid)
{
$connection = DatabaseUtility::getConnectionForTable('pages');
return $connection->executeQuery('select * from pages where uid=' . (int)$uid . ' limit 1')->fetchAssociative();
}
Same Issue with Forms in workspaces. Then the uid is -1. And then the resullt ist false instead of an array.