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

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

cilefen’s picture

@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?

Berdir’s picture

That'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.

rizzie made their first commit to this issue’s fork.

rizzie’s picture

Status: Active » Needs review
cilefen’s picture

I am adding myself a mentor credit for walking @rizzie through this.

claudiu.cristea’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Needs review » Reviewed & tested by the community

I 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.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Can we get an inline comment explaining why this is necessary? Otherwise it might get "cleaned up" in the future. :) Thanks!

xjm’s picture

Issue tags: +Prague2022
ChrisDarke’s picture

This issue is tagged for first time contributors at DrupalCon Prague 2022.

ChrisDarke’s picture

Issue summary: View changes
floWweb’s picture

hi from drupalcon2022! It's my firt time contributor and i want to test contribute for this issue

Berdir’s picture

@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.

claudiu.cristea’s picture

Status: Needs work » Reviewed & tested by the community

  • catch committed f5766a4 on 10.0.x
    Issue #3279289 by rizzie, claudiu.cristea, Berdir, cilefen:...
  • catch committed 784ee65 on 10.1.x
    Issue #3279289 by rizzie, claudiu.cristea, Berdir, cilefen:...
  • catch committed 64581a5 on 9.5.x
    Issue #3279289 by rizzie, claudiu.cristea, Berdir, cilefen:...
catch’s picture

Version: 9.4.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.