Errors on search-only for deep-nested paragraphs

Created on 2 February 2021, almost 4 years ago
Updated 8 May 2023, over 1 year 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 over 1 year 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 12 months 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

Production build 0.71.5 2024