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

FILTER_VALIDATE_URL returns false when it should return true #10901

Closed
lolcatw opened this issue Mar 21, 2023 · 1 comment
Closed

FILTER_VALIDATE_URL returns false when it should return true #10901

lolcatw opened this issue Mar 21, 2023 · 1 comment

Comments

@lolcatw
Copy link

lolcatw commented Mar 21, 2023

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

@iluuu1994
Copy link
Member

iluuu1994 commented Mar 21, 2023

You need to urlencode for the × character. https://3v4l.org/tnV99 Modern browser will replace percent encoded characters for usability. See https://stackoverflow.com/questions/2742852/unicode-characters-in-urls for more information.

@iluuu1994 iluuu1994 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2023
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

2 participants