I have been installed Joomla 5 beta 1 for testing and running it on PHP 8.2 and discovered the following notice:
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home//public_html//libraries/vendor/joomla/registry/src/Format/Json.php on line 55
It occurs in a 3rd party extension, but according to the character of the notice, it is related to the core code.
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
PHP 8.x
|
Another one in a third party plugin:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /libraries/src/Plugin/PluginHelper.php on line 64
And my question is the same as Ruud asked - who is responsible for this, core or developers?
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-27 14:23:55 |
Closed_By | ⇒ | Hackwar |
This is the responsibility of the third party developers. They have to check if they actually are handing over any data and not null. The docblocks of the methods are very clear about this and require strings in this area. We should also not silently cast this to string or something like that to make the notice go away, since it actually points to a larger issue in the third party extension. Since this is not a Joomla bug, but one of third party devs, I'm closing this one.
Seeing multiple of these deprecated notices also on J4 (see below for two recent examples). Question for me is: should these Joomla functions validate extension input (like on submitting a form you should always validate user input), or do we trust the developers here?
if a string is expected, then passing null should either be type casted or it should throw an error (for the extension dev to fix):