Needs review
Project:
GovDelivery Integration
Version:
8.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 May 2020 at 20:03 UTC
Updated:
12 Jun 2020 at 23:38 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
drupal.ninja03 commentedI am using a VM that runs Ubuntu so when I run the drush command to install the module I get the error:
The module install fails but next time I run the install command again then no error shows and the module gets installed.
The error points to the following in the govdelivery.module file
The line of contention is:
if (static::setupTrustedHosts($request, $host_patterns) === FALSE)Not sure why it is throwing error on first installation and not on second time.
Comment #3
drupal.ninja03 commentedComment #4
drupal.ninja03 commentedI have created a patch to address the error on this line:
if (static::setupTrustedHosts($request, $host_patterns) === FALSE)from the .module file. As we cannot use "static" if it is not inside a class.
This seems to solve the error.
Comment #5
alfattal commentedThank you drupal.ninja03, the patch in #4 solved this issue!
Comment #6
alfattal commentedNow, I'm getting warning
Undefined variable: account_fieldset in Drupal\govdelivery\Form\GovDeliverySettingsForm->buildForm() (line 195 of modules/contrib/govdelivery/src/Form/GovDeliverySettingsForm.php).on this page/admin/config/services/govdelivery/tms_settings.Full warning message:
Comment #7
drupal.ninja03 commentedI was able to reproduce the error. It is because as the error says, there is an undefined variable: $account_fieldset being used
But the part where $account_fieldset is being assigned that part of the code is commented out. Moreover, I don't know what that 'accounts' key stands for in a fieldset. Commenting out that line removes the error. Submitting the patch for the same.
Comment #8
alfattal commentedHi @drupal.ninja03. Patch in #7 failed to apply (See the attached screenshot). Have you tested it?
Comment #9
drupal.ninja03 commentedHi @alfattal,
Yes, I have tested it again just now and it applies. I used the git apply command:
git apply ~/Downloads/3137652-7.patchAlso tested by adding to composer.json file:
Comment #10
alfattal commentedThank you @drupal.ninja03. My bad, I was try to apply both patches in #4 and #7!