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
Issue fork project_browser-3252674
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
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahComment #5
rajab natshahComment #6
gaurav.kapoor commentedNot 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 dataIs the latest development release broken?
Comment #7
tim.plunkettComment #9
tim.plunkettThis unit test is extremely convoluted. I'm not sure how valuable it is. But it catches the bug!
Comment #10
chrisfromredfinThe 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.
Comment #11
tim.plunkettAll this code went away in #3274906: Evaluate direct usage of Guzzle, Doctrine, etc in DrupalOrgClient::createGuzzleClient() and #3279510: Reevaluate or remove DrupalOrgClient