Skip to content

FILTER_VALIDATE_URL returns false when it should return true #10901

@lolcatw

Description

@lolcatw

Description

The following code:

<?php
var_dump(filter_var("https://www.bug.com/wp-content/uploads/2022/09/Famous-Internet-Man-512-×-512-px-1.png", FILTER_VALIDATE_URL));

Resulted in this output:

bool(false)

But I expected this output instead:

string(x) <url here>

This seems to be due to the fact that the URL contains -x-.

Many thanks.

PHP Version

7.4.33

Operating System

Debian 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions