On the translated node the comment preview functionality is not working

Created on 3 June 2020, about 4 years ago
Updated 13 June 2024, 13 days ago

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 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"

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:

  1. $ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
  2. install Drupal (for example, use drush si to install Drupal in Italian):
  3.   $ 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 \
  4. add other languages (e.g., Marathi and French) via UI at admin/config/regional/language
  5. otherwise leave defaults (e.g., skip enabling language switching block; leave Detection and selection method as Url; leave language prefixes unchanged)
  6. 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
  7. after that add translation to the content
  8. Navigate to the article with the default language. e.g. url /node/
  9. add a comment to the article and hit preview
  10. it will show the comment preview + form + content
  11. save the comment.
  12. now navigate to the translated article page, for french the url will be /fr/node/
  13. add a comment to the article and hit preview
  14. it will lead to WSOD, or some error log

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.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Comment 

Last updated about 15 hours ago

Created by

🇮🇳India rahul.shinde Pune

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Merge request !7742hide comment field after entity build → (Open) created by sukr_s
  • Pipeline finished with Failed
    2 months ago
    Total: 174s
    #156665
  • Pipeline finished with Success
    2 months ago
    #156668
  • Status changed to Needs review 2 months ago
  • Status changed to RTBC about 1 month ago
  • 🇺🇸United States smustgrave

    No one has chimed in so maybe it is okay.

    1) Drupal\Tests\comment\Functional\CommentPreviewTest::testCommentPreviewOnTranslatedNode
    Behat\Mink\Exception\ResponseTextException: The text "Preview comment" was not found anywhere in the text of the current page.
    /builds/issue/drupal-3145146/vendor/behat/mink/src/WebAssert.php:907
    /builds/issue/drupal-3145146/vendor/behat/mink/src/WebAssert.php:293
    /builds/issue/drupal-3145146/core/tests/Drupal/Tests/WebAssert.php:975
    /builds/issue/drupal-3145146/core/modules/comment/tests/src/Functional/CommentPreviewTest.php:287
    /builds/issue/drupal-3145146/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    ERRORS!
    Tests: 4, Assertions: 118, Errors: 1.
    

    Test coverage is there and the fix does solve the issue.

    Going to mark.

  • Status changed to Needs work about 1 month ago
  • 🇳🇿New Zealand quietone New Zealand

    I 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 📌 [Meta] Perform set-up tasks in Browser tests using API calls rather than browser requests Active for examples.

    Also, needs a title update.

  • Pipeline finished with Failed
    30 days ago
    Total: 2967s
    #183122
  • Pipeline finished with Success
    30 days ago
    Total: 485s
    #183174
  • Status changed to Needs review 30 days ago
  • 🇮🇳India sukr_s

    - Queries answered
    - Tests changed to use API instead of browser call for setting up data.

  • 🇺🇸United States smustgrave

    Should move to NW for title update but left a comment on MR that's up for discussion.

  • Status changed to Needs work 13 days ago
  • 🇺🇸United States smustgrave

    Left a comment but am moving to NW for the title update mentioned in #14

  • 🇮🇳India sukr_s

    @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.

Production build 0.69.0 2024