Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
brainfoolong opened this issue Aug 30, 2021 · 0 comments · Fixed by #2454
Closed
1 task done

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

brainfoolong opened this issue Aug 30, 2021 · 0 comments · Fixed by #2454

Comments

@brainfoolong
Copy link
Contributor

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.

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Dec 18, 2021
Fix PHPOffice#2281. Delete auto filter set range to null, but should set it to null string. This causes a deprecation warning in Php8.1.
oleibman added a commit that referenced this issue Dec 25, 2021
* Null Passed to AutoFilter SetRange

Fix #2281. Delete auto filter set range to null, but should set it to null string. This causes a deprecation warning in Php8.1.

* Constructor Call Also Sets Range to Null

Should set it to null string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant