content_defender
content_defender copied to clipboard
Exception inside md5() call when there is no backend layout
We have content elements that use EXT:flux and EXT:fluidcontent. They are in the folder that does not have backend layout assigned. Now, when searching for content element by uid in the Backend and opening them in the List view, I see the exception:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: md5() expects parameter 1 to be string, null given | TypeError thrown in file /var/www/vhosts/xxx/typo3conf/ext/content_defender/Classes/BackendLayout/BackendLayoutConfiguration.php in line 61. Requested URL: https://xxx/typo3/index.php?route=%2Frecord%2Fedit&token=--AnonymizedToken--&edit%5Btt_content%5D%5B9338%5D=edit&returnUrl=%2Fcms%2Ftypo3%2Findex.php%3FM%3Dweb_list%26moduleToken%3D0912ea2b47ce5a3eb74993debaa31333c2d0ca74%26id%3D347
The problem is in EXT:content_defender/Classes/BackendLayout/BackendLayoutConfiguration.php
:
public function getConfigurationByColPos($colPos)
{
$configurationIdentifier = md5($this->backendLayout['config']);
Basically it uses non-existing backend layout config. There should be a check. I hotfixed it with
public function getConfigurationByColPos($colPos)
{
$configurationIdentifier = md5((string)$this->backendLayout['config']);
and it works fine for me. I will make a PR but you may want to look for better solution :)