Bug->Req #70588 [Nab]: tel:nnnn URLs are converted to host+port incorrectly

From: Date: Sun, 27 Sep 2015 09:14:25 +0000
Subject: Bug->Req #70588 [Nab]: tel:nnnn URLs are converted to host+port incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196270@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70588&edit=1 ID: 70588 Updated by: chx@php.net Reported by: jcnventura at yahoo dot com Summary: tel:nnnn URLs are converted to host+port incorrectly Status: Not a bug -Type: Bug +Type: Feature/Change Request Package: URL related Operating System: Ubuntu LTS 14.04 PHP Version: 5.6.14RC1 Block user comment: N Private report: N New Comment: So I think this is a feature request. Previous Comments: ------------------------------------------------------------------------ [2015-09-27 09:13:21] chx@php.net I am not sure what could be done here. Every bit of code out there that codes around tel: recognized as it is recognized now will immediately break if this is changed. That's probably undesired. The BNF of RFC 3966 says telephone-uri = "tel:" telephone-subscriber and telephone-subscriber is not a path, not a port, no, it's a telephone-subscriber. Considering the above, I'd recommend a new optional telephone-subscriber return key in parse_url and a constant accordingly and not changing any of the previous values. ------------------------------------------------------------------------ [2015-09-26 14:04:28] jcnventura at yahoo dot com I now believe this is a real bug, as tel: is still both a URI and a URL. According to the available info, a URI is either a URL or a URN (or both). To be a URN, it must start with "urn:", which it clearly does not, thus confirming its status as a URL. ------------------------------------------------------------------------ [2015-09-26 12:49:46] jcnventura at yahoo dot com While technically true, the fact was that tel: WAS a URL before, and it's still wildly used out there. parse_url("tel:911") should be able to call 911, and not try to connect to port 911 on the tel host. ------------------------------------------------------------------------ [2015-09-26 11:32:58] requinix@php.net tel: is a URI, not a URL, and as the note in parse_url's documentation says, >This function is intended specifically for the purpose of parsing URLs and not URIs. ------------------------------------------------------------------------ [2015-09-26 11:25:47] jcnventura at yahoo dot com Description: ------------ When calling parse_url with tel:nnnn with n <= 65535, the valid URL according to RFC 3966 gets converted to a host+port pair. The code in ext/standard/url.c (php_url_parse_ex) should be fixed to detect the tel schema and not goto parse_port in this case. Expected result: ---------------- var_export(parse_url("tel:65535")); array ( 'scheme' => 'tel', 'path' => 65535, ) var_export(parse_url("tel:65536")); array ( 'scheme' => 'tel', 'path' => 65536, ) var_export(parse_url("tel:6000")); array ( 'scheme' => 'tel', 'path' => 6000, ) var_export(parse_url("tel:600000")); array ( 'scheme' => 'tel', 'path' => '600000', ) Actual result: -------------- var_export(parse_url("tel:65535")); array ( 'host' => 'tel', 'port' => 65535, ) var_export(parse_url("tel:65536")); false // Tries to match with a port, but outside range. var_export(parse_url("tel:6000")); array ( 'host' => 'tel', 'port' => 6000, // Shouldn't be a port !? ) var_export(parse_url("tel:600000")); array ( 'scheme' => 'tel', 'path' => '600000', // Expected result. ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70588&edit=1

« previous php.bugs (#196270) next »