Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in WebClient.php #43415

Closed
o-joomla-issues opened this issue May 2, 2024 · 3 comments

Comments

@o-joomla-issues
Copy link

Steps to reproduce the issue

Do a raw http request on an URL that gets redirected, like / on a multi-language site:
$ openssl s_client -connect some-website.com:443
GET / HTTP/1.1[enter]
Host: some-website.com[enter]
[enter]

Expected result

No error

Actual result

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 380 (and other lines)

System information

php8.3-fpm 8.3.6-1+020240424.32+debian121.gbp9a7ce5

Additional comments

I don't know which client actually does http request without user agent, but I see these errors in the logs quite often.
Anyway, we should always validate user-supplied variables.

An easy fix should be:
htdocs/libraries/vendor/joomla/application/src/Web/WebClient.php
[...]
public const NONE = 0; // maybe UNKOWN instead?
[...]
protected function detectEngine($userAgent)
{
if(empty(trim($userAgent))) {
$this->engine = self::NONE;
} elseif [...]
}

@brianteeman
Copy link
Contributor

As your fix is in libraries/vendor/joomla/application then it should be reported/fixed there and not in the cms
https://github.com/joomla-framework/application

Can be closed as not a bug in the cms but in the upstream library

@alikon
Copy link
Contributor

alikon commented May 2, 2024

please test joomla-framework/application#124

@alikon alikon closed this as completed May 2, 2024
@o-joomla-issues
Copy link
Author

Sorry, I was mislead by the "Library" option in the categories selection. I didn't appear to me that "Joomla! Issue Tracker - CMS" excludes the Joomla library (although I am certainly aware of the difference between the CMS and the framework).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants