Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

PHP Notice: "Undefined offset: 2" if allowed_hosts contains subdomains #62

Open
codegain opened this issue Jul 14, 2021 · 0 comments
Open

Comments

@codegain
Copy link

codegain commented Jul 14, 2021

Hi,

I recently got the following error:

Notice: Undefined offset: 2

here:

if ($uriParts[$key] !== $trustedPart) {

I got this error after adding a subdomain to allowed_hosts like sub.example.org and this causes the function to be called with the following parameters if a url like https://example.org in a href attribute is sanitized:

$uriParts = ['org', 'example']; 
$trustedParts = ['org', 'example', 'sub'];

Is a subdomain not allowed in allowed_hosts or is this a bug?

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

No branches or pull requests

1 participant