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

Fix some "Passing null to parameter" warnings (PHP8.1) #19135

Merged
merged 5 commits into from Apr 25, 2022

Conversation

MichaelRoosz
Copy link
Contributor

This fixes:

WARNING Referrers
plugins/Referrers/Columns/Base.php(525): 
Deprecated - mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

WARNING Referrers
plugins/Referrers/Columns/Base.php(478): 
Deprecated - urldecode(): Passing null to parameter #1 ($string) of type string is deprecated

WARNING Events
core/Twig.php(363): Deprecated - str_replace(): 
Passing null to parameter #3 ($subject) of type array|string is deprecated

WARNING UsersManager
plugins/UsersManager/Model.php(662): Deprecated - explode():
Passing null to parameter #2 ($string) of type string is deprecated

WARNING UsersManager
plugins/UsersManager/Model.php(210):
Deprecated - explode(): Passing null to parameter #2 ($string) of type string is deprecated

WARNING Login
libs/HTML/QuickForm2/Rule/Nonempty.php(96): 
Deprecated - strlen(): Passing null to parameter #1 ($string) of type string is deprecated

First priority was to keep the existing behavior to avoid creating any bugs.

core/Twig.php Outdated
@@ -360,6 +360,11 @@ protected function addFilter_notification()
protected function addFilter_safeDecodeRaw()
{
$rawSafeDecoded = new TwigFilter('rawSafeDecoded', function ($string) {

if (!$string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one actually changes the result. The string 0 will no be returned as empty string. That can be seen in the UI test results. Maybe we need to check if it is a string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, or maybe we could just directly do $string === null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgiehl PR has been updated

@sgiehl sgiehl added this to the 4.10.0 milestone Apr 25, 2022
@sgiehl
Copy link
Member

sgiehl commented Apr 25, 2022

Thanks for the contribution @MichaelRoosz

@sgiehl sgiehl merged commit e7febeb into matomo-org:4.x-dev Apr 25, 2022
@justinvelluppillai justinvelluppillai changed the title Fix some "Passing null to parameter" warnings Fix some "Passing null to parameter" warnings (PHP8.1) May 9, 2022
@justinvelluppillai justinvelluppillai added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label May 9, 2022
@MichaelRoosz MichaelRoosz deleted the fix-passing-null branch October 29, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP8.1 compatibility fixes in referrers plugin
3 participants