Problem/Motivation
In a multilingual site, if you are adding a comment on a node that is in the default language, the preview functionality works as expected.
Whereas, on the translated node the comment preview functionality results in an error as it tries to render the comment field in an infinite loop.
Steps to reproduce the issue
This is very easy to replicate on simplytest.me (choose multilingual setup).
If simplytest.me is down (as it currently appears to be), use the following:
$ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
- install Drupal (for example, use drush si to install Drupal in Italian):
- add other languages (e.g., Marathi and French) via UI at admin/config/regional/language
- otherwise leave defaults (e.g., skip enabling language switching block; leave Detection and selection method as Url; leave language prefixes unchanged)
- add an article in the default language (by default the article content type includes all entity requirements involved in this bug report) /node/add/article
- after that add translation to the content
- Navigate to the article with the default language. e.g. url /node/
- add a comment to the article and hit preview
- it will show the comment preview + form + content
- save the comment.
- now navigate to the translated article page, for french the url will be /fr/node/
- add a comment to the article and hit preview
- it will lead to WSOD, or some error log
$ drush si standard \
--db-url='mysql://root@127.0.0.1/some_dir'
--account-name="Kay V" --account-pass=silly.walk.ministry \
--site-name=Some-Dir \
--site-mail=noreply@example.com \
Proposed resolution
Set the status of the comment field on the entity to hidden after the preview is built.
Remaining tasks
Patch.
User interface changes
None.
API changes
Not sure.
Data model changes
None.
Original report by rahul.shinde
In a multilingual site, if you are adding a comment on a node that is in the default language, the preview functionality works as expected.
Whereas, on the translated node the comment preview functionality throws the following message when Xdebug is on,"The website encountered an unexpected error. Please try again later."
with watchdog entry
Error: Maximum function nesting level of '512' reached, aborting! in Drupal::service() (line 157 of /app/core/lib/Drupal.php)
......
otherwise, find the following error in the PHP error log,"PHP Fatal error: Maximum execution time of 30 seconds exceeded in ../vendor/symfony/http-foundation/Request.php on line 2108"