FriendsOfTYPO3 / frontend_editing

TYPO3 CMS Frontend Editing
https://friendsoftypo3.github.io/frontend_editing/
102 stars 39 forks source link

Crash page when rendering text contents with empty body [still occurs] #567

Closed olinox14 closed 2 years ago

olinox14 commented 2 years ago

I'm sorry, but the bug signaled in the issue #554 issue still occurs:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: Argument 1 passed to TYPO3\CMS\FrontendEditing\ViewHelpers\ContentEditableViewHelper::renderAsTag() must be of the type string, null given, called in /var/www/typo3/public/typo3conf/ext/frontend_editing/Classes/ViewHelpers/ContentEditableViewHelper.php on line 108 | TypeError thrown in file /var/www/typo3/public/typo3conf/ext/frontend_editing/Classes/ViewHelpers/ContentEditableViewHelper.php in line 180.

My extension is in version 2.0.9, and Typo3 is in 10.4.21

olinox14 commented 2 years ago

The strange part is that even if the error is still logged for some of the websites we host, I can not reproduce it on my testing env... Also, even if an error is logged in the BE, the page is still showing, without any visible error.

MattiasNilsson commented 2 years ago

@olinox14 Ok I have a hard time to reproduce this one also. Do you use the same TYPO3 and PHP version locally? Which template engine are you using?

hacksch commented 2 years ago

@MattiasNilsson I had this error too and found the reason. In a special case i had a empty tag. <core:contentEditable table="tt_content" uid="{uid}"></core:contentEditable> In this case $content in the viewHelper is not a string any more. When you add a space it works without any error.

Hope it helps to reproduce

olinox14 commented 2 years ago

@MattiasNilsson Yeah, my local env is the very same that the production env, same versions of php and typo3.

All of my templates are built with Fluid (+Flux and VHS)

olinox14 commented 2 years ago

The very strange part is that this error seems to resolve by itself... I had this error again logged this morning: Core: Exception handler (WEB): Uncaught TYPO3 Exception: Argument 1 passed to TYPO3\CMS\FrontendEditing\ViewHelpers\ContentEditableViewHelper::renderAsTag() must be of the type string, null given, ...

When I check the page, there are indeed two contents with null content on this page.

But when I request this page, no problem: the page displays, no error logged... Why was an error logged 2 hours ago, and not now?

Could this be caused by some code of the previous version of fe_editing that would be cached somewhere? Through I flushed all of the typo3 caches when I updgraded fe_editing to its latest version...

UPDATE: Just found out why I couldn't reproduce, the error does not occur when the be_user is logged. Could you try theses steps to reproduce?

  1. Add a text type content to a page
  2. Set its bodytext to null directly in DB
  3. Request this page in a private nav window
MattiasNilsson commented 2 years ago

Thanks all for the nice feedback! I have fixed it and now released it for version 2 and version 3 of the extension.

https://github.com/FriendsOfTYPO3/frontend_editing/releases/tag/2.0.12

https://github.com/FriendsOfTYPO3/frontend_editing/releases/tag/3.0.6