Problem/Motivation

Some values are getting empty data in the Drupal.org Client class

Steps to reproduce

Given that the "Project Browser" module was installed under Drupal 9.2.x
And logged in as the "webmaster" user no. 1
And cleared the cache
When navigating to "/admin/modules/browse"
Then the following notice will show up

Error message
Notice: Undefined index: date in Drupal\project_browser\DrupalOrg\DrupalOrgClient->Drupal\project_browser\DrupalOrg\{closure}() (line 216 of modules/contrib/project_browser/src/DrupalOrg/DrupalOrgClient.php).
Notice: Undefined index: date in Drupal\project_browser\DrupalOrg\DrupalOrgClient->Drupal\project_browser\DrupalOrg\{closure}() (line 216 of modules/contrib/project_browser/src/DrupalOrg/DrupalOrgClient.php).

Proposed resolution

Have pre-checks on compatible releases.

          if (!empty($compatible_releases)) {
            $project['releases'] = array_map(function($release) {
              return [
                'version' => $release['version'],
                'status' => $release['status'],
                'date' => $release['date'],
                'core_compatibility' => $release['core_compatibility'],
              ];
            }, $compatible_releases);
            $add_to_db[] = $project;
          }

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Addition/Change/Update/Fix to this project
  • ☐ Testing to ensure no regression
  • ☐ Automated unit/functional testing coverage
  • ☐ Developer Documentation support on feature change/addition
  • ☐ User Guide Documentation support on feature change/addition
  • ☐ Code review from 1 Drupal core team member
  • ☐ Full testing and approval
  • ☐ Credit contributors
  • ☐ Review with the product owner
  • ☐ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Category: Task » Bug report
gaurav.kapoor’s picture

Not able to verify this as project browser isn't loading for me in local. Getting this error:

Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Is the latest development release broken?

tim.plunkett’s picture

Issue tags: +Needs tests

tim.plunkett’s picture

Status: Active » Needs review

This unit test is extremely convoluted. I'm not sure how valuable it is. But it catches the bug!

chrisfromredfin’s picture

The code is all well and good, but I'm sadly not at liberty to review the quality of the test, since I don't understand much of it.

I would be inclined to mark RTBC but I think it needs another set of eyes.

tim.plunkett’s picture