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
No error message
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
This was related to mod_search module. I've fixed the code and the ModuleHelper error message has gone.
Thanks
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.
please see joomla-extensions/search#23
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
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.
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```
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
Labels |
Added:
PHP 8.x
|
Labels |
Added:
bug
|
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.
@fignewt18 can you please let us know how to reproduce this step by step
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.
still unable to reproduce
anyone else ?
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 ;)
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
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
Yootheme Pro
JSitemap Pro
FOF (?)
German (DE)
pkg_search
Suche
Has anything changed?
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:
@.***>
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)
Same problem on our website, php8.1 and Joomla latest version...
@ylubin Please report your issue here: https://github.com/joomla-extensions/search
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>
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
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?
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 = "";
}
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-01-05 06:57:29 |
Closed_By | ⇒ | alikon |
please test joomla-framework/application#121
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.
the fix was backported to 4 some times ago joomla-framework/application#122
If it's been fixed, then why does it keep happening every time I update php?
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
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.
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.