No Code Attached Yet PHP 8.x bug
avatar geraandras
geraandras
18 Nov 2022

Steps to reproduce the issue

Lastest Joomla 4 switched from PHP 7.4.33 to 8.1 caused this (from error log):
PHP Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /home/...account.../...domain.../libraries/src/Helper/ModuleHelper.php on line 85

Expected result

No error message

Actual result

System information (as much as possible)

Additional comments

Votes

# of Users Experiencing Issue
1/2
Average Importance Score
5.00

avatar geraandras geraandras - open - 18 Nov 2022
avatar geraandras geraandras - change - 18 Nov 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 18 Nov 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Nov 2022
avatar geraandras geraandras - change - 18 Nov 2022
The description was changed
avatar geraandras geraandras - edited - 18 Nov 2022
avatar joomdonation
joomdonation - comment - 30 Nov 2022

Could you please let us know step by step what we need to do to see this error (prefer with a fresh Joomla 4.2.5 installation if it is possible)

With just something from error logs like this, it's hard for us to know where the issue comes from to find out the reason and fix it.

avatar geraandras
geraandras - comment - 2 Dec 2022

This was related to mod_search module. I've fixed the code and the ModuleHelper error message has gone.
Thanks

avatar joomdonation
joomdonation - comment - 2 Dec 2022

Exactly how you fix it? If it is a bug for mod_search, we should get it fixed, too. If you can report the issue at https://github.com/joomla-extensions/search , that would be great.

avatar alikon
alikon - comment - 3 Dec 2022
avatar chmst
chmst - comment - 3 Dec 2022

It probably has nothing to do with mod search but appears when you add a module with {loadmodule moduletype}.

Confusing. I geht the warning
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in plugins\content\loadmodule\loadmodule.php on line 120

avatar joomdonation
joomdonation - comment - 5 Dec 2022

I believe the fix which @alikon fixed to search module is not related to this issue.

@chmst The issue you are having, I guess it is unrelated to this issue, too. If you have a clear way to re-procedure this issue, please open a new issue. I think the fix is something related to the fix on this PR #39229 .

@geraandras Would be great if you could let us know how we could see this issue ourself or how you fixed it. It would give us some clues about this issue and have it fixed.

avatar geraandras
geraandras - comment - 5 Dec 2022

I started to fix few plugins based on error log. Search was one and the last of them.
As I can't turn back the wheel of time, I can't tell you the exact solution. Sorry for that, I will document it better for next time.
Anyway, I still get thises deprecated PHP warnings in error log.
[02-Dec-2022 14:48:03 UTC] PHP Deprecated: urldecode(): Passing null to parameter #1 ($string) of type string is deprecated in /home/idiwebsite/public_html/components/com_search/models/search.php on line 81

[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 308
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 313
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 318
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 323
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 328
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 333
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 338
[02-Dec-2022 14:32:40 UTC] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/idiwebsite/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php on line 343```
avatar aschkenasy
aschkenasy - comment - 3 Jan 2023

this is seemingly all over the code base.

libraries/vendor/joomla/application/src/Web/WebClient.php throws
explode(): Passing null to parameter #2 ($string) of type string is deprecated on line 406

avatar Quy Quy - change - 3 Feb 2023
Labels Added: PHP 8.x
avatar Quy Quy - labeled - 3 Feb 2023
avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar fignewt18
fignewt18 - comment - 20 Mar 2023

I am seeing the same issue stated by aschkenasy. Joomla install 4.2.9 and PHP 8.1.17. I get

Deprecated
: explode(): Passing null to parameter #2 ($string) of type string is deprecated in
/home/customer/www/mysite.com/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php
on line
406

PHP 7.4.33 does not have this conflict.


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

avatar alikon
alikon - comment - 21 Mar 2023

@fignewt18 can you please let us know how to reproduce this step by step

avatar fignewt18
fignewt18 - comment - 21 Mar 2023

To reproduce this all I have to do on my site is change the PHP version to 8.1.17 and login to the backend of the site. At PHP version 7.4.33 I don't see this fault. At the previous version of Joomla I did not seem to get this behavior (It may have been 4.2.5 that I had installed). I played with some of the other versions of PHP and am seeing some gantry/template issues as well. Perhaps that could be the root cause of my issue. At PHP 8.0.28 the frontend loads normally but the backend is just a white screen. At PHP 8.2.4 nothing loads at all.
Dashboard at 7 4 33
Dashboard at 8 1 17

avatar alikon
alikon - comment - 21 Mar 2023

still unable to reproduce
anyone else ?

avatar jaccsnl
jaccsnl - comment - 23 Mar 2023

Same issue here..

Reproduce is possible by just installing a clean version of Joomla! 4.2.9 and use PHP8.1.17
Than you will see this message, I have this in all websites when I use PHP 8.1.x

Host is SiteGround in my case, don't know if that is changing anything?

Now I am using PHP 8.0.28 because this version does not cause this message, but want to use a newer PHP version..
And PHP 8.2.4 crashes site..? thats for another day ;)


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

avatar carlitorweb
carlitorweb - comment - 10 Apr 2023

Similar deprecated message on PHP 8.1.17

Got error '/libraries/vendor/joomla/application/src/Web/WebClient.php on line 328PHP message: PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in 
/htdocs/libraries/vendor/joomla/application/src/Web/WebClient.php on line 333PHP message: PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in htdocs/libraries/vendor/joomla/application/src/Web/WebClient.php on line 338PHP
avatar carlitorweb
carlitorweb - comment - 10 Apr 2023

And PHP 8.2.4 crashes site..?

@jaccsnl Joomla is not yet full compatible with 8.2

avatar Mich-es
Mich-es - comment - 21 Apr 2023

Same issue Joomla! 4.2.9 and after use PHP8.1.17

[21-Apr-2023 04:49:35 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 343
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 303
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 308
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 313
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 318
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 323
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 328
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 333
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 338
[21-Apr-2023 06:09:17 Europe/Berlin] PHP Deprecated:  stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/www/libraries/vendor/joomla/application/src/Web/WebClient.php on line 343

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39237.
avatar brianteeman
brianteeman - comment - 21 Apr 2023

What extensions and templates are you using?
To get a full list go to the System dashboard and select Manage->Extensions and then filter the list by Non-Core Extensions
image

avatar Mich-es
Mich-es - comment - 21 Apr 2023

Yootheme Pro
JSitemap Pro
FOF (?)
German (DE)
pkg_search
Suche


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39237.
avatar Mich-es
Mich-es - comment - 26 Jun 2023

Has anything changed?

avatar fignewt18
fignewt18 - comment - 26 Jun 2023

I do not seem to be having this issue anymore on my site. I think it may
have been a gantry conflict.

On Mon, Jun 26, 2023, 1:38 PM Mich-es @.***> wrote:

Has anything changed?


Reply to this email directly, view it on GitHub
#39237 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A6ND5TSJQA6OHG2TPA33IVLXNHCHRANCNFSM6AAAAAASEPQJXU
.
You are receiving this because you were mentioned.Message ID:
@.***>

avatar allynat
allynat - comment - 27 Jun 2023

Joomla4.3.2+PHP8.1.20
Experiencing this same error
PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in libraries/vendor/joomla/application/src/Web/WebClient.php on line (various line numbers)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39237.
avatar ylubin
ylubin - comment - 4 Sep 2023

Same problem on our website, php8.1 and Joomla latest version... screen shot 2023-09-04 at 12 18 29


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

avatar Quy
Quy - comment - 5 Sep 2023

@ylubin Please report your issue here: https://github.com/joomla-extensions/search

avatar UKFed
UKFed - comment - 30 Dec 2023

I had this problem and it seemed to be the file: WebClient.php located at
libraries/vendor/joomla/application/src/Web/WebClient.php

stripos was causing the error as the $userAgent string was NULL.

ORIGINAL CODE
protected function detectPlatform($userAgent)
{
// Attempt to detect the client platform.
if (*stripos($userAgent, 'Windows')* !== false) {
$this->platform = self::WINDOWS;

        // Let's look at the specific mobile options in the Windows space.
        if (\stripos($userAgent, 'Windows Phone') !== false) {
            $this->mobile   = true;
        ...[continued]

UPDATED CODE
protected function detectPlatform($userAgent)
{ if ($userAgent === null) {
$userAgent = "";
}

// Attempt to detect the client platform.
if (\stripos($userAgent, 'Windows') !== false) {
$this->platform = self::WINDOWS;

        // Let's look at the specific mobile options in the Windows space.
        if (\stripos($userAgent, 'Windows Phone') !== false) {
            $this->mobile   = true;
        ...[continued]<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/39237">issues.joomla.org/tracker/joomla-cms/39237</a>.</sub>
avatar samlatif
samlatif - comment - 4 Jan 2024

Hi, i have the same error:

PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /libraries/vendor/joomla/application/src/Web/WebClient.php on line 286. --
on joomla, PHP 8.2.14, template cassiopia


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

avatar samlatif
samlatif - comment - 4 Jan 2024

I have the sam error,
PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /libraries/vendor/joomla/application/src/Web/WebClient.php on line 286.

joomla4.4 PHP 8.2.14 template Cassiopeia. Any suggestions to solve it?


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

avatar UKFed
UKFed - comment - 4 Jan 2024

Yes, see my post above as a quick fix.

Basically add the following code to the started of protected function detectPlatform($userAgent) function in /libraries/vendor/joomla/application/src/Web/WebClient.php
{ if ($userAgent === null) {
$userAgent = "";
}


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

avatar alikon alikon - change - 5 Jan 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-01-05 06:57:29
Closed_By alikon
avatar alikon alikon - close - 5 Jan 2024
avatar alikon
alikon - comment - 5 Jan 2024
avatar UKFed
UKFed - comment - 22 Apr 2024

Please can someone help me?

Every time I update a my Joomla! site running on PHP 8.1.28 I keep getting this error come back:
Deprecated: stripos(): Passing null to parameter #1 (Shaystack) of type string is deprecated in /var/www/vhosts/example.com/libraries/vendor/joomla/application/src/Web/WebClient.php on line 470

I have to manually patch the file by adding if (!isset($userAgent)) { $userAgent = ""; } to line line 468 of the detectPlatform function.

The problem only happens for the odd occasional user - I guess when their browser sends a NULL UserAgent?

I am running J 4.4.4 and really need some help as this is driving me nuts - every update is a pain.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39237.
avatar alikon
alikon - comment - 22 Apr 2024

the fix was backported to 4 some times ago joomla-framework/application#122

avatar UKFed
UKFed - comment - 22 Apr 2024

If it's been fixed, then why does it keep happening every time I update php?

avatar UKFed
UKFed - comment - 22 Apr 2024

So, you don't think it's the Joomla! update itself? I have seen the code in Joomla! update to...

 if (\stripos($userAgent, 'Windows Phone') !== false) {
                $this->mobile   = true;
                $this->platform = self::WINDOWS_PHONE;
            } elseif (\stripos($userAgent, 'Windows CE') !== false) {
                $this->mobile   = true;
                $this->platform = self::WINDOWS_CE;
            }

This still results in the error, despite having the \ before stripos

avatar carlitorweb
carlitorweb - comment - 22 Apr 2024

So, you don't think it's the Joomla! update itself? I have seen the code in Joomla! update to...

 if (\stripos($userAgent, 'Windows Phone') !== false) {
                $this->mobile   = true;
                $this->platform = self::WINDOWS_PHONE;
            } elseif (\stripos($userAgent, 'Windows CE') !== false) {
                $this->mobile   = true;
                $this->platform = self::WINDOWS_CE;
            }

This still results in the error, despite having the \ before stripos

Sorry, I deleted the comment. I wrote it in the wrong place.

Add a Comment

Login with GitHub to post a comment