On the translated node the comment preview functionality is not working

Created on 3 June 2020, over 4 years ago
Updated 25 April 2024, 8 months 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

The user should see the Preview of the comment on the translated node.

Remaining tasks

Patch.

User interface changes

None.

API changes

Not sure.

Data model changes

None.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Comment 

Last updated 11 days 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
    8 months ago
    Total: 174s
    #156665
  • Pipeline finished with Success
    8 months ago
    #156668
  • Status changed to Needs review 8 months ago
  • Status changed to RTBC 7 months 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 7 months ago
  • 🇳🇿New Zealand quietone

    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
    7 months ago
    Total: 2967s
    #183122
  • Pipeline finished with Success
    7 months ago
    Total: 485s
    #183174
  • Status changed to Needs review 7 months 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 6 months 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.

  • Status changed to Needs review 4 months ago
  • 🇮🇳India sukr_s

    Taken a shot at updating IS.

  • 🇺🇸United States smustgrave

    Title seems fine to me.

  • 🇫🇮Finland YevKo Espoo

    I was able to reproduce the issue with 11.0.1 and MR fixed it!

  • 🇫🇮Finland YevKo Espoo
  • The 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.

  • Status changed to Needs work 12 days ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Thanks for working on this, left a suggestion

  • First commit to issue fork.
  • Pipeline finished with Failed
    11 days ago
    Total: 154s
    #365045
Production build 0.71.5 2024