Skip to content

PHP 8.1 Worksheet->removeAutoFilter setting setRange to null result in errors #2281

@brainfoolong

Description

@brainfoolong

This is:

  • a bug report

What is the expected behavior?

No error :)

What is the current behavior?

strrpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

What are the steps to reproduce?

On a sheet, call $sheet->removeAutoFilter()
This will internally call $this->autoFilter->setRange(null) where null will cause the error.
I temporarily fixed it with replacing it with an empty string, but i am not sure if this is a correct fix.

Most minimal example

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getSheet(0);
$sheet->removeAutoFilter();

Which versions of PhpSpreadsheet and PHP are affected?

Current Master as well as current stable release. The master have some significant changes to stable but this error is still not fixed.

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