joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.79k stars 3.66k forks source link

PHP 8.2 Legacy Error in WebClient.php not solved by #42830 #43334

Open ssabatini opened 7 months ago

ssabatini commented 7 months ago

Steps to reproduce the issue

View PHP Error log for Joomla site with PHP 8.2.X. Look for warnings "stripos(): Passing null to parameter https://github.com/joomla/joomla-cms/pull/1 ($haystack) of type string is deprecated ..."

Expected result

No warnings regarding "stripos(): Passing null to parameter https://github.com/joomla/joomla-cms/pull/1 ($haystack) of type string is deprecated ..." anymore.

Actual result

42830 has fixed this warning only in the function detectBrowser(), but the same warning (with the same reason) is produced by the functions detectEngine() and detectPlatform().

Additionally, the function detectRobot() does as well not test if the user agent is null.

alikon commented 7 months ago

please check https://github.com/joomla-framework/application/pull/124

ssabatini commented 7 months ago

@alikon The fix looks good. The first fix with issue #42830 should be unnecessary now; the if ($userAgent !== null) in the method detectBrowser can be removed.

Quy commented 2 months ago

Please test https://github.com/joomla-framework/application/pull/131

ssabatini commented 3 weeks ago

The fix 131 does not solve null $userAgent in detectEngine($userAgent) and detectPlatform($userAgent). I would propose to use the solution provided in 124.