Problem/Motivation

After upgrading from PHP 7.4 to 8.0 locally the following error started showing when launch the simpletest runner:

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in scripts/run-tests.sh on line 331

The error happens because $_SERVER['SERVER_SOFTWARE'] is NULL when the script starts.

Steps to reproduce

Start scripts/run-tests.sh with PHP 8.0.

Proposed resolution

Fix the bug.

Remaining tasks

Fix the bug.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

n/a

CommentFileSizeAuthor
#2 drupal-n3276848-2.patch752 bytesdamienmckenna

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new752 bytes

Identified the problem being caused by $_SERVER['SERVER_SOFTWARE'] not having a value when the script runs. So that's an easy fix.

damienmckenna’s picture

Title: run-tests.sh gives "Deprecated: str_replace(): Passing null to parameter" » run-tests.sh gives "Deprecated: str_replace(): Passing null to parameter" with PHP 8.0
Priority: Normal » Minor
poker10’s picture

I have added it to the list of compatibility issues with PHP 8.1.

joseph.olstad’s picture

looks like a good fix, thanks @DamienMcKenna and @poker10 and @mcdruid

steinmb’s picture

Status: Needs review » Reviewed & tested by the community
mcdruid’s picture

Issue tags: +RTBM

I'd perhaps make the comment less specific as different environments may have different empty elements in the $_SERVER array, but it's fine as it is.

I think this is ready for commit. Thanks!

  • poker10 committed 2464f11 on 7.x
    Issue #3276848 by DamienMcKenna: run-tests.sh gives "Deprecated:...
poker10’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -RTBM

Thanks all!

Status: Fixed » Closed (fixed)

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