Skip to content

PHP 8.1 deprecated warning #5066

@Sweetchuck

Description

@Sweetchuck

To Reproduce
PHP 8.1
drush/drush 11.0.5
Custom test which uses the \Drush\TestTraits\DrushTestTrait::drush()
The optional $suffix = null argument causes the problem.
$cmd[] = $suffix;
$exec = array_filter($cmd, 'strlen');

Expected behavior
No warnings and errors.

Actual behavior
Deprecated: strlen(): Passing null to parameter 1 ($string) of type string is deprecated in /project/vendor/drush/drush/src/TestTraits/DrushTestTrait.php on line 79

Workaround
Probably a lazy error_reporting value in php.ini, but I haven't tried it.

System Configuration

Q A
Drush version? 11.0.5
Drupal version? 9.3.5
PHP version 8.1.2
OS? Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions