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.
Problem/Motivation
Discovered in #3277649: Deprecation notice for htmlspecialchars with php 8.1, which calls file_requirements() from a kernel test.
Steps to reproduce
Proposed resolution
Add a ?? '' after \Drupal::request()->server->get('SERVER_SOFTWARE')
Remaining tasks
Add an inline comment explaining why this is necessary
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3279289
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
cilefen CreditAttribution: cilefen commented@Berdir:
I think that rather than the null coalesce operator the second parameter to
\Drupal::request()->server->get()
should be set to an empty string. Agree?Comment #3
BerdirThat's fine too, although I have just recently come across a really weird case in the Symfony Request class where a key was set to NULL explicitly and then the fallback didn't work because Symfony uses arary_key_exists() for the fallback and explicitly "supports" NULL elements.
Comment #6
rizzie CreditAttribution: rizzie commentedComment #7
cilefen CreditAttribution: cilefen commentedI am adding myself a mentor credit for walking @rizzie through this.
Comment #8
claudiu.cristeaI hit this with 8.1. Tested and works as it should, thanks. I think it's a bug and could be merged in 9.4.x.
Comment #9
xjmCan we get an inline comment explaining why this is necessary? Otherwise it might get "cleaned up" in the future. :) Thanks!
Comment #10
xjmComment #11
ChrisDarke CreditAttribution: ChrisDarke commentedThis issue is tagged for first time contributors at DrupalCon Prague 2022.
Comment #12
ChrisDarke CreditAttribution: ChrisDarke commentedComment #13
floWweb CreditAttribution: floWweb at WebstanZ commentedhi from drupalcon2022! It's my firt time contributor and i want to test contribute for this issue
Comment #14
Berdir@floWweb: Great. This is a good first time task to actually make the change, but maybe coming up with the description not quite as much. I would say that it should mention that server software might not be set in a CLI environment and we ensure that it is a string for the regular expression check below.
Comment #15
claudiu.cristeaComment #17
catchCommitted/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!