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

use null coalesce to suppress deprecation notice in php 8.1 #6129

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

munkiepus
Copy link

Signed-off-by: Tony Dunlop [email protected]

spotted a deprecation notice when running unit test with php 8.1

addresses the following:

RuntimeException: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated on line 726 in file /vendor/codeigniter/framework/system/core/Common.php

@munkiepus
Copy link
Author

munkiepus commented Apr 12, 2022

hmm, just noticed the tests failed for php 5.x, is that still supported? might need to change the null coalesce for a ternary if is?

@gxgpet
Copy link
Contributor

gxgpet commented Apr 12, 2022

Hello!
Yes, we still aim at maintaining compatibility with PHP 5. But no worries, if we find there's a bug that we should handle, we can ensure that $str is a string in other ways.

The only way that this would happen is that either you are passing NULL as the value of $str, or that over that iteration, $str gets nulled by preg_replace() call.

Could you please share an example of how we could reproduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants