Errors on search-only for deep-nested paragraphs

Created on 2 February 2021, about 4 years ago
Updated 8 May 2023, almost 2 years ago
πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mariacha1

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

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

  • πŸ‡ΊπŸ‡ΈUnited States bdanin

    This still errors for me with a nested paragraph:
    ResponseText: Error: Call to undefined method Drupal\block_content\Entity\BlockContent::getParentEntity() in Drupal\scanner\Plugin\Scanner\Paragraph->search() (line 73 of /app/docroot/modules/contrib/scanner/src/Plugin/Scanner/Paragraph.php).

  • Status changed to Needs work almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    That error indicates there's a block being loaded, not a paragraph; we probably need to update the logic to protect against that.

  • πŸ‡ΊπŸ‡ΈUnited States bdanin

    It's a paragraph inside a block that's loading.

  • πŸ‡ΊπŸ‡ΈUnited States earthday47 New York

    I needed to reroll the patch in #20 for 1.0-rc7. I made a couple of code formatting tweaks but left the logic alone - there are some things in there that are a little unusual, goto and while(1==1) , that make it a little hard to follow. It probably needs a little more work.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    3 pass
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Thanks for rerolling it, glad to see the tests pass now.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    The patch needs work:

    1. This line:

    +          checkPE:
    
    +            if (is_null($parentEntity)) goto checkPE;
    

    That gives off some bad code smell.

    2. This part needs cleaning up:

    +                // Two or more levels of nesting.
    +                else {
    +                  if (!is_null($parentEntity->getEntityTypeId())) {
    +                    while (1 == 1) {
    +                      if (is_null($parentEntity)) break;
    +                      $tempA = $parentEntity->getEntityTypeId();
    +                      if (is_null($tempA)) break;
    +                      if ($tempA == 'node') break;
    +                      $parentEntity = $parentEntity->getParentEntity();
    +                    }
    +                  }
    +                }
    
  • πŸ‡¨πŸ‡¦Canada gwvoigt London, ON πŸ‡¨πŸ‡¦

    Last patch gives me:

    An AJAX HTTP error occurred.
    HTTP Result Code: 200
    Debugging information follows.
    Path: /batch?id=410&op=do_nojs&op=do
    StatusText: parsererror
    ResponseText: Error: Call to undefined method Drupal\paragraphs\Entity\Paragraph::getTitle() in Drupal\scanner\Plugin\Scanner\Paragraph->search() (line 115 of /app/web/modules/contrib/scanner/src/Plugin/Scanner/Paragraph.php).

  • πŸ‡¨πŸ‡¦Canada gwvoigt London, ON πŸ‡¨πŸ‡¦

    Last patch gives me:

    An AJAX HTTP error occurred.
    HTTP Result Code: 200
    Debugging information follows.
    Path: /batch?id=410&op=do_nojs&op=do
    StatusText: parsererror
    ResponseText: Error: Call to undefined method Drupal\paragraphs\Entity\Paragraph::getTitle() in Drupal\scanner\Plugin\Scanner\Paragraph->search() (line 115 of /app/web/modules/contrib/scanner/src/Plugin/Scanner/Paragraph.php).

  • πŸ‡¨πŸ‡¦Canada gwvoigt London, ON πŸ‡¨πŸ‡¦

    Modified patch from #25 to address issues from #28

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    3 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update over 1 year ago
    3 pass
  • Status changed to Needs review over 1 year ago
  • πŸ‡¨πŸ‡¦Canada gwvoigt London, ON πŸ‡¨πŸ‡¦
  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States banoodle San Francisco, CA

    I tried the patch from #30 on D10.2 site, but I still get the error reported in #28.

  • If a parent entity doesn't have getParentEntity() method, it returns the error below:

    Error: Call to undefined method Drupal\block_content\Entity\BlockContent::getParentEntity() in Drupal\scanner\Plugin\Scanner\Paragraph->search() (line 70 of /var/www/html/web/docroot/modules/contrib/scanner/src/Plugin/Scanner/Paragraph.php)

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    I can confirm the issue from #33 regarding incompatibility with block_content (which is quite widely used). I created a separate issue for that now: πŸ› Incompatibility with block_content module Active

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    MR!1 looks very promising and the logic is much better than the existing. I think we should stop posting patches and instead finish the MR!1. Could someone please check, which changes the MR is missing from the comments and update it accordingly?

    I also left some comments. I think we're quite close to fixing this!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Closed πŸ› Incompatibility with block_content module Active as duplicate.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Can we update for 2.0.x please

  • πŸ‡¬πŸ‡§United Kingdom aaron.ferris

    Just wanted to add some notes from https://www.drupal.org/project/scanner/issues/3448005 πŸ› Scanner finds older paragraphs from node revisions Active which I think can be closed as a duplicate, because this approach should (at least from my local testing) resolve the issue over there. Does need a reroll, which I can try and take a look at.

    Setup
    1. Drupal 10.3
    2. Scanner 1.0/2.0 beta
    3. ERR 1.12
    4. Paragraphs 1.18
    5. Setup as above
    6. Add a new paragraph with a string field
    7. Add a paragraphs field to the basic page content type, allow references to the new paragraph
    8. Add a new basic page
    9. Use 'old paragraph value' as the string
    10. Save
    11. Edit this node
    12. Remove the old paragraph, add a new one, use 'new paragraph value' as the field value
    13. Save
    14. In scanner, search for 'old paragraph value'
    15. Expected: 0 results
    16. Actual: 0 results
    17. Search for 'new paragraph value'
    18. Expected: 1 result
    19. Actual: 1 result

  • πŸ‡ͺπŸ‡¨Ecuador LeonelEnriquez98

    I've created a patch based on the current merge request, but it can be applied to version 2.0.0-beta1.

Production build 0.71.5 2024