No Code Attached Yet
avatar Ruud68
Ruud68
28 Dec 2022

Steps to reproduce the issue

Issue started after update to Joomla 4.2.6 and is due to change #38977

call HTMLHelper::_('content.prepare', null, '', 'test');

above test is only to show the error, a component is able to push null to the function, e.g. when the value comes from parameters and the parameter is not set it will return null.

Deprecated: strpos(): Passing null to parameter # 1 ($haystack) of type string is deprecated in [root]/plugins/content/loadmodule/loadmodule.php on line 58

when doing a dump of $article in the plugin it shows $article->text = null

Expected result

no warning

Actual result

Deprecated: strpos(): Passing null to parameter # 1 ($haystack) of type string is deprecated in [root]/plugins/content/loadmodule/loadmodule.php on line 58

System information (as much as possible)

Joomla 4.2.6
PHP 8.1

Additional comments

this can be fixed by also checking on !is_null($article->text).

if (!is_object($article) || !property_exists($article, 'text') || is_null($article->text)) {
avatar Ruud68 Ruud68 - open - 28 Dec 2022
avatar Ruud68 Ruud68 - change - 28 Dec 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Dec 2022
avatar richard67 richard67 - close - 29 Dec 2022
avatar richard67
richard67 - comment - 29 Dec 2022

Closing as having a pull request. Please test #39522 . Thanks in advance.

avatar richard67 richard67 - change - 29 Dec 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-12-29 18:15:57
Closed_By richard67

Add a Comment

Login with GitHub to post a comment