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"
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | 3145146-nr-bot.txt | 1.05 KB | needs-review-queue-bot |
Issue fork drupal-3145146
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
cptX commentedThis issue is already discussed here https://www.drupal.org/project/drupal/issues/2751269
Comment #3
cptX commentedCreated a new topic here to raise general awareness for all these issues the comment module has https://www.drupal.org/project/drupal/issues/3196886
Comment #6
larowlanComment #12
sukr_s commentedComment #13
smustgrave commentedNo one has chimed in so maybe it is okay.
Test coverage is there and the fix does solve the issue.
Going to mark.
Comment #14
quietone commentedI read the IS, comments and the MR. There is an unanswered query in the MR. I will set this to needs work for that.
The test should be changed to use the API for setup tasks. See #3305376: [Meta] Perform set-up tasks in Browser tests using API calls rather than browser requests for examples.
Also, needs a title update.
Comment #15
sukr_s commented- Queries answered
- Tests changed to use API instead of browser call for setting up data.
Comment #16
smustgrave commentedShould move to NW for title update but left a comment on MR that's up for discussion.
Comment #17
smustgrave commentedLeft a comment but am moving to NW for the title update mentioned in #14
Comment #18
sukr_s commented@smustgrave could you help with the title update please. I'm not sure what it needs to change to as the current title explains the problem aptly.
Comment #19
sukr_s commentedTaken a shot at updating IS.
Comment #20
smustgrave commentedTitle seems fine to me.
Comment #21
yevko commentedI was able to reproduce the issue with 11.0.1 and MR fixed it!
Comment #22
yevko commentedComment #23
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #24
needs-review-queue-bot commentedFalse positive
Comment #25
larowlanThanks for working on this, left a suggestion