You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will probably need an Apple device to view website, since it appears this error only occurs when viewing site on an Apple device.
Actual problem
PHP Deprecated errors producing in large amounts in Error Log file on non-Windows devices.
This report is all about the file located here in Joomla 5.1.2:
/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php
It looks like the specific section of code that is causing a problem, is between lines 460 to 510.
The heading of this code section says: Detects the client platform in a user agent string.
What I have been doing
Since upgrading to Joomla 5.1.2, my Error Log is producing 100,000's of the same repeated PHP Deprecated errors, every few days. The weird thing I can see in the error log, is that the same repeated errors appear in "batches" at specific time intervals. Sometimes this error is happening and other times it stops completely. The errors are intermittent.
I couldn't generate the same errors when browsing my site using Windows 11 and Google Chrome, Firefox or Edge, which was driving me crazy, until I looked at the specific lines of code that are being reported in the error log file. I strongly suspect that the only way to replicate this problem, is to view Joomla using an Apple device like an iPhone, which I do not own, which makes it impossible for me to replicate.
Please note that I also have Kunena forum installed on my site, in case that is part of the problem?
My theory as to cause of problem
Something between lines 460 and 510 in the WebClient.php file, is producing errors when viewed on a device that matches the parameters mentioned in this specific section on the file. Code listed at bottom of this message.
Error Log
The repeated errors in Error Log are the following:
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in .../libraries/vendor/joomla/application/src/Web/WebClient.php on line 502
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 505
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 526
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 472
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 483
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 494
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 498
Section of /libraries/vendor/joomla/application/src/Web/WebClient.php causing problem:
/**
* Detects the client platform in a user agent string.
*
* @param string $userAgent The user-agent string to parse.
*
* @return void
*
* @since 1.0.0
*/
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;
$this->platform = self::WINDOWS_PHONE;
} elseif (\stripos($userAgent, 'Windows CE') !== false) {
$this->mobile = true;
$this->platform = self::WINDOWS_CE;
}
} elseif (\stripos($userAgent, 'iPhone') !== false) {
// Interestingly 'iPhone' is present in all iOS devices so far including iPad and iPods.
$this->mobile = true;
$this->platform = self::IPHONE;
// Let's look at the specific mobile options in the iOS space.
if (\stripos($userAgent, 'iPad') !== false) {
$this->platform = self::IPAD;
} elseif (\stripos($userAgent, 'iPod') !== false) {
$this->platform = self::IPOD;
}
} elseif (\stripos($userAgent, 'iPad') !== false) {
// In case where iPhone is not mentioed in iPad user agent string
$this->mobile = true;
$this->platform = self::IPAD;
} elseif (\stripos($userAgent, 'iPod') !== false) {
// In case where iPhone is not mentioed in iPod user agent string
$this->mobile = true;
$this->platform = self::IPOD;
} elseif (\preg_match('/macintosh|mac os x/i', $userAgent)) {
// This has to come after the iPhone check because mac strings are also present in iOS devices.
$this->platform = self::MAC;
} elseif (\stripos($userAgent, 'Blackberry') !== false) {
$this->mobile = true;
$this->platform = self::BLACKBERRY;
} elseif (\stripos($userAgent, 'Android') !== false) {
$this->mobile = true;
$this->platform = self::ANDROID;
Regards,
Derek.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Will probably need an Apple device to view website, since it appears this error only occurs when viewing site on an Apple device.
Actual problem
PHP Deprecated errors producing in large amounts in Error Log file on non-Windows devices.
This report is all about the file located here in Joomla 5.1.2:
/public_html/libraries/vendor/joomla/application/src/Web/WebClient.php
It looks like the specific section of code that is causing a problem, is between lines 460 to 510.
The heading of this code section says:
Detects the client platform in a user agent string.
What I have been doing
Since upgrading to Joomla 5.1.2, my Error Log is producing 100,000's of the same repeated PHP Deprecated errors, every few days. The weird thing I can see in the error log, is that the same repeated errors appear in "batches" at specific time intervals. Sometimes this error is happening and other times it stops completely. The errors are intermittent.
I couldn't generate the same errors when browsing my site using Windows 11 and Google Chrome, Firefox or Edge, which was driving me crazy, until I looked at the specific lines of code that are being reported in the error log file. I strongly suspect that the only way to replicate this problem, is to view Joomla using an Apple device like an iPhone, which I do not own, which makes it impossible for me to replicate.
Please note that I also have Kunena forum installed on my site, in case that is part of the problem?
My theory as to cause of problem
Something between lines 460 and 510 in the WebClient.php file, is producing errors when viewed on a device that matches the parameters mentioned in this specific section on the file. Code listed at bottom of this message.
Error Log
The repeated errors in Error Log are the following:
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in .../libraries/vendor/joomla/application/src/Web/WebClient.php on line 502
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 505
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 526
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 472
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 483
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 494
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 498
System information (as much as possible)
Joomla 5.1.2
PHP 8.2.22
MariaDB 10.6.19
Webserver Litespeed
Kunena forum installed.
Section of /libraries/vendor/joomla/application/src/Web/WebClient.php causing problem:
Regards,
Derek.
The text was updated successfully, but these errors were encountered: