IchHabRecht / content_defender

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

Copy plugins not possible #130

Closed MaximilianSchweiger closed 1 year ago

MaximilianSchweiger commented 1 year ago

Hello,

I have installed your extension on the following system:

Now I have the problem that every time I try to copy a plugin element I get the following message:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: count(): Argument #1 ($value) must be of type Countable|array, null given | TypeError thrown in file /mnt/c/Projekte/typo3/###clientname###/private/typo3conf/ext/content_defender/Classes/Repository/ContentRepository.php in line 73. Requested URL: http://###clienturl###/typo3/ajax/record/process?token=--AnonymizedToken--&CB[paste]=tt_content|16&CB[pad]=normal&CB[update][colPos]=1&CB[update][sys_language_uid]=0

I tried the following plugins (on the latest version):

Once I uninstall your extension, I no longer have the problem. Can you help me with this problem?

IchHabRecht commented 1 year ago

Hi @MaximilianSchweiger,

I tried to reproduce the problem in a current TYPO3 11.5 installation with PHP 8.1.9 but I don't get the Exception. System is in development mode and error handling is set to debug as well. Can you give me a step by step instruction what you are doing? Is there any pageTS on that page? Are you using an admin or user account?

MaximilianSchweiger commented 1 year ago

Hi @IchHabRecht,

I have done the following on my system:

Then I created a container element on a blank new page and inserted a TextMedia element into each col including content. Next I tried to copy the element via right click. The error occurs afterwards when trying to paste this. In various tests I noticed that no matter what allowed content element is contained in the container element, the error occurs. Also, the container element should be empty.

However, I can copy the container elements once your extension is disabled. I don't change anything else in the code and leave all bindings as they are.

I am also in development mode and logged in as admin.

Thanks for the help and should you need any more please get in touch.

IchHabRecht commented 1 year ago

Hi @MaximilianSchweiger,

Thank you for your answer. Are you able to reproduce this problem in an installation without container? As far as I know container uses some content_defender classes if available and might miss some compatibility.

MaximilianSchweiger commented 1 year ago

Hi @IchHabRecht ,

I have tried to copy an element which is not in a container. Unfortunately, I seem to have the same error here. However, I did not notice this problem before.

Neither your nor the container extension should be installed. I can copy everything. But I did not have the case to need only the content_defender extension at a TYPO3 installation.

What I can confirm, however, is that the problem does not occur with another system. Here I have the following configuration: Operating system: Unix

So only the versions of the extensions differ. On the system with the problem the following versions are used:

Maybe this helps, that with the updates some compatibility no longer works.

IchHabRecht commented 1 year ago

Hi @MaximilianSchweiger,

Thank you for your reply. As long as the container extension is active its code is executed during a copy command is executed nevertheless, I guess. That's why I ask you to try to reproduce it in an installation without container being active. As I'm not able to reproduce the problem, I can't help to solve it. If it is some compatibility issue, I can't solve it as well as I'm not able to change the code of the container extension ;-)

IchHabRecht commented 1 year ago

@MaximilianSchweiger

Please see #131 for a follow up. Maybe this is related to your configuration as well.