No Code Attached Yet
avatar RickR2H
RickR2H
21 Feb 2024

Steps to reproduce the issue

Set error reporting to maximum
Create a category blog menu item
Set PHP to 8.2 or higher
Open the blog layout page on the frontend

Expected result

No deprecation warning

Actual result

You'll get the error: Deprecated: mb_strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in C:\wamp64\www\roc\public_html\libraries\vendor\joomla\string\src\phputf8\mbstring\core.php on line 44

This is probably caused by the email cloak plugin. When this plugin is disabled, the error is gone.

System information (as much as possible)

J5.0.3 / Apache / PHP 8.2

Additional comments

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar RickR2H RickR2H - open - 21 Feb 2024
avatar RickR2H RickR2H - change - 21 Feb 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 21 Feb 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Feb 2024
avatar richard67
richard67 - comment - 21 Feb 2024

@RickR2H Do you get a call stack shown when switching on "Debug System" in Global Configuration? If yes, post a screenshot or text copy here. Thanks in advance.

avatar richard67 richard67 - change - 21 Feb 2024
Labels Added: Information Required
avatar richard67 richard67 - labeled - 21 Feb 2024
avatar RickR2H
RickR2H - comment - 21 Feb 2024

@richard67 Here is the call stack
The debug system of Joomla gives no feedback.

image

avatar richard67 richard67 - change - 21 Feb 2024
Labels Removed: Information Required
avatar richard67 richard67 - unlabeled - 21 Feb 2024
avatar alikon
alikon - comment - 23 Feb 2024

i was able to replicate the issue only with this hack, from

$text = $this->cloak($item->text);

to

$text = $this->cloak(null);

btw
to be on the safe side #42865

avatar alikon alikon - change - 23 Feb 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-02-23 17:52:31
Closed_By alikon
avatar alikon alikon - close - 23 Feb 2024
avatar PhocaCz
PhocaCz - comment - 2 Mar 2024

EDIT: Sorry, I missed this PR ( #42865 ) , which solves it:

This problem still can occur (version Joomla 5.0.3) in case, e.g. some 3pd extension uses:

HTMLHelper::_('content.prepare', $description);

and the description is null (replace the description variable with anything), then this null is chained to cloak method and StringHelper::strpos method which then produces this error in vendor/joomla/string/src/phputf8/mbstring/core.php:45

I didn't test if there can be some place which can hypothetically use null in HTMLHelper::_('content.prepare', ...); in core, but there is a lot of places in core:

  • EmailCloak (plugins/content/emailcloak/src/Extension/EmailCloak.php 122, 127)
  • StringHelper::strpos (libraries/vendor/joomla/string/src/StringHelper.php 147)
  • utf8_strpos (vendor/joomla/string/src/phputf8/mbstring/core.php 45)
    which can simply prevent it.

Either by adding (string) or a condition preventing method calls with null.

So, even if this problem is hypothetical in e.g. core, it may not apply to the extensions using HTMLHelper and its correction in 42865 is needed.

Thank you @alikon

avatar artemismatla
artemismatla - comment - 5 Apr 2024

having the same issue! when i disable the plugin "Content - Email Cloaking" the error is fixed. do we need that plugin "Content - Email Cloaking" ?? what is it for? it will get resolved in the next joomla uopdate?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42846.

avatar chmst
chmst - comment - 5 Apr 2024

Yes, we need this plugin. The problem is fixed in version 5.1. as you can see here: #42865

avatar brianteeman
brianteeman - comment - 5 Apr 2024

plus you should never run a live site with error reporting on

avatar artemismatla
artemismatla - comment - 5 Apr 2024

plus you should never run a live site with error reporting on

that site, with error reporting on, is the demo site for the checks before we update the live one!

Add a Comment

Login with GitHub to post a comment