-
Notifications
You must be signed in to change notification settings - Fork 132
Description
Description of the problem
Issue reported by Chris Wong via Slack (@chunkitchris)
"I set up a local server with PHP 8.20 and did some initial work. Then, I exported the database and imported it to the production server, which is running PHP 8.2.12. I continued to work on the production site by entering data from my clients. After that, I exported the database and imported it back to my local server for further development. When I tried to access a channel with the Bloqs add-on, an error message was displayed.
Turns out this is caused by use of an untrapped call to $file->getAbsoluteURL() on line 840 of legacy/libraries/File_field.php. If the function call returns null, this is passed to str_replace() and it is this passing of null to the php function that causes the deprecation error.
How To Reproduce
As per description - in Chris' case it seems to have been triggered by something related to Bloqs add-on, but the cause of the warning is independent of that.
Error Messages
Deprecated
str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated
ee/legacy/libraries/File_field.php, line 840
Severity: E_DEPRECATED
Environment Details:
- Version: 7.4.10
- PHP Version 8.2.0
Possible Solution
Put in a check to ensure that the value returned by$file->getAbsoluteURL()is not null before calling the php str_replace function.