Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If an environment is created without a hostname entered, the following error is thrown:
InvalidArgumentException: The URI '/admin/config/development/environment-indicator/switcher' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 282 of /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Url.php).
In my use case I wish to have various environment templates set up as part of a profile, and this bug prevents my from doing this and having consistent settings across projects.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3122913-2-InvalidArgumentException.patch | 1.47 KB | John Cook |
Comments
Comment #2
John Cook CreditAttribution: John Cook at Creode commentedThe bug is caused in
_environment_indicator_switcher_links()
when constructing the links:Drupal\Core\Url->fromUri()
throws the exception because the constructed URL does not have a scheme.In the patch I've added a filter to remove any
EnvironmentIndicator
entities that do not have a URL before the link is constructed for them.Comment #3
John Cook CreditAttribution: John Cook at Creode commentedSet to 'needs review'.
Comment #4
pratik_kambleComment #5
Jancy Christopher CreditAttribution: Jancy Christopher commentedComment #6
Jancy Christopher CreditAttribution: Jancy Christopher commentedThis patch works fine for me.
Steps followed.
- After configuring the Environment Indicator Module.
- Go to /admin/config/development/environment-indicator, in Environment Switcher tab Add a new environment by clicking the Add environment button.
- Add a new environment by giving an empty hostname. The above invalid uri issue occurs.
- After applying the patch this issue got resolved and able to create multiple Environments templates with empty hostname.
Thanks for the patch.
Comment #7
Jancy Christopher CreditAttribution: Jancy Christopher commentedComment #8
e0ipsoThanks for the patch!
Comment #10
e0ipso