Docblock Parser breaks on Exif module

Created on 6 May 2023, almost 2 years ago
Updated 8 May 2023, almost 2 years ago

Problem/Motivation

With the exif module, the parser breaks on /api/exif/src!Controller!ExifSettingsController.php/class/ExifSettingsController/8.x-2.x
short error message:
TypeError: Drupal\api\Entity\DocBlock::findClassesByNamespacedName(): Argument #2 ($branch_ids) must be of type array, null given, called in /app/web/modules/contrib/api/src/Formatter.php on line 1594 in Drupal\api\Entity\DocBlock::findClassesByNamespacedName() (line 908 of modules/contrib/api/src/Entity/DocBlock.php).

Steps to reproduce

Add exif module 8.x-2.x

Proposed resolution

Either resolve error or make into a warning that the docblock is unsupported and make a friendly warning/log instead of 500 error.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Parser

Created by

🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

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

Comments & Activities

  • Issue created by @nickdickinsonwilde
  • First commit to issue fork.
  • @fjgarlin opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇪🇸Spain fjgarlin

    Thanks for reporting @NickDickinsonWilde and for the example of working vs non-working page, that helped a lot.

    I think the reason was the branch not having a core version value. I reviewed the code and saw that in this case, we were getting NULL where a string was expected, so I added a few fallbacks and checks for this and the page now renders as expected.

    Related fixes:
    When I set the project with the QuickWizard form, I saw that the core version is not set properly for the 8.x-2.x. There is actually a status message prompting users to review the value: Please review the "Core compatibility" fields in each branch..

    This is due to the module wrapping the `core_version_requirement` in quotes. Checking other contrib modules, none of them have it.
    In any case, and due to this, I added a little bit of code that should trim quotes and spaces from values, and log a message to the logger for strings that might not pass the Semver validation.

    All of the above can be seen in the MR. Please review.

  • Status changed to RTBC almost 2 years ago
  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Yeah I saw that message about reviewing core compatibility. I thought I had but I guess I missed that one (I did add a bunch of things at once/in a row) - it was empty.
    In any case, that looks good to me and resolves the issue, thanks.

    • fjgarlin committed 2bbd8867 on 2.x
      Issue #3358624 by fjgarlin, NickDickinsonWilde: Docblock Parser breaks...
  • Status changed to Fixed almost 2 years ago
  • 🇪🇸Spain fjgarlin

    Thanks for reviewing and confirming that it resolves the issue.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024