Bug #71368 [Opn]: FILTER_VALIDATE_URL rejects URLs starting with phar:///

From: Date: Fri, 12 Mar 2021 12:41:40 +0000
Subject: Bug #71368 [Opn]: FILTER_VALIDATE_URL rejects URLs starting with phar:///
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232673@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71368&edit=1 ID: 71368 Updated by: cmb@php.net Reported by: bschussek at gmail dot com Summary: FILTER_VALIDATE_URL rejects URLs starting with phar:/// Status: Open Type: Bug Package: Filter related Operating System: Ubuntu 14.04 LTS PHP Version: 7.0.2 Block user comment: N Private report: N New Comment: More specifically, there is no special support for the phar protocol in parse_url_ex2(), but there is for the file protocol[1]. [1] <https://github.com/php/php-src/blob/php-7.4.16/ext/standard/url.c#L175-L176> Previous Comments: ------------------------------------------------------------------------ [2020-04-15 16:42:21] cmb@php.net This is because these URLs are rejected by parse_url()[1]. [1] <https://3v4l.org/uaF2G> ------------------------------------------------------------------------ [2016-01-14 11:52:01] bschussek at gmail dot com Description: ------------ FILTER_VALIDATE_URLS rejects URLs starting with "phar:///". Test script: --------------- <?php var_dump(filter_var('file://c:/path/to/dir', FILTER_VALIDATE_URL)); var_dump(filter_var('file:///path/to/dir', FILTER_VALIDATE_URL)); var_dump(filter_var('phar://c:/path/to/dir', FILTER_VALIDATE_URL)); var_dump(filter_var('phar:///path/to/dir', FILTER_VALIDATE_URL)); Expected result: ---------------- string(21) "file://c:/path/to/dir" string(19) "file:///path/to/dir" string(21) "phar://c:/path/to/dir" string(19) "phar:///path/to/dir" Actual result: -------------- string(21) "file://c:/path/to/dir" string(19) "file:///path/to/dir" string(21) "phar://c:/path/to/dir" bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71368&edit=1

« previous php.bugs (#232673) next »