Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@melroy89
Copy link
Member

@melroy89 melroy89 commented Sep 13, 2024

EntryComment can be null after all during the __invoke. So comment can still be null. Let's update Twig to check for defined and not null, to avoid template errors..


100% repeatable now. Eg. https://kbin.melroy.org/m/[email protected]/t/457088/The-entire-staff-of-beloved-game-publisher-Annapurna-Interactive-has/comment (so without any comment ID at the end provided in the URL)

Will give:

{"message":"Uncaught PHP Exception Twig\\Error\\RuntimeError: \"Error rendering \"entry_comment\" component: Expected argument of type \"App\\Entity\\EntryComment\", \"null\" given at property path \"comment\".\" at view.html.twig line 49","context":{"exception":{"class":"Twig\\Error\\RuntimeError","message":"Error rendering \"entry_comment\" component: Expected argument of type \"App\\Entity\\EntryComment\", \"null\" given at property path \"comment\".","code":0,"file":"/var/www/kbin.melroy.org/html/templates/entry/comment/view.html.twig:49","previous": ... }

With error:

image


However, with this patch. You will no longer get this 500 error ⛱️ . And show an error instead:

image

@melroy89 melroy89 added bug Something isn't working frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end labels Sep 13, 2024
@melroy89 melroy89 added this to the v1.7.2 milestone Sep 13, 2024
@melroy89
Copy link
Member Author

Also added an error with a back button in case of an empty/null entry comment...

@melroy89 melroy89 enabled auto-merge (squash) September 13, 2024 16:46
@melroy89
Copy link
Member Author

Tested and works as expected now.

@melroy89 melroy89 merged commit 89c1334 into main Sep 13, 2024
@melroy89 melroy89 deleted the check_entry_comment_defined_and_not_null branch September 13, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants