-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Deprecated: trim(): Passing null to parameter #1 ($string) #41803
Comments
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):
|
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? |
In my reported issue I proposed a solution: if that is approved then it is a nobrainer in quickly fixing these notices for php 8.2 by doing PR's when we run into one. |
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. |
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.
The text was updated successfully, but these errors were encountered: