IchHabRecht / content_defender

Define allowed or denied content element types in your backend layouts
GNU General Public License v2.0
81 stars 38 forks source link

[BUGFIX] Avoid unsafe array access to colPos #150

Open smichaelsen opened 7 months ago

smichaelsen commented 7 months ago

When content elements are created as inline records (for example in news) they usually don't come with a colPos. This results in a fatal error with PHP 8.

IchHabRecht commented 7 months ago

Hi @smichaelsen,

Please see my comment on #143. I still think it's wrong to fall back to colpos 0 as there might be some configuration which gets applied here. There needs to be a check for some whitelist items according to some value from the request and return early without any content_defender interaction.

smichaelsen commented 7 months ago

You mean an early return in the content_defender hook class if some crucial fields are not provided? I can change my PR in that direction, if you want.