Repository navigation
Description
Description of the problem
The URL fieldtype's "Allowed URL schemes" setting offers tel:// as an option, but there is no tel: option. tel:// is not a valid form of the tel URI scheme.
Per RFC 3966, a telephone URI is tel: followed directly by the number (e.g. tel:+1-555-555-1234). It has no authority component, so there is no // like there is in http:// or ftp://.
This matters in practice:
- Entering a correct
tel:link (e.g.tel:+15555551234) fails validation even whentel://is checked in the field settings, so authors are pushed into entering the wrong format. tel://links can fail to trigger click-to-call in some browsers and mobile OSes, because the dialer doesn't recognize the malformed URI.
I expected to be able to allow and enter standard tel: links, the same way mailto: works today.
How To Reproduce
- Create a URL field.
- In the field settings, check
tel://under "Allowed URL schemes." - Edit an entry and enter
tel:+15555551234in the field. - Save. Validation fails with the invalid URL scheme error.
- Change the value to
tel://+15555551234and save. It passes, but it's an invalidtelURI.
Screenshots / Videos / Template Code
Environment Details:
- Version: 7.5.28
- PHP Version: 8.3
- MySQL Version: mariadb 11.4
- OS: Alpine Linux (DDEV)
- Web Server: NGINX (DDEV)
Possible Solution
Add tel: as its own allowed scheme, following the existing mailto: precedent in system/ee/ExpressionEngine/Addons/url/ft.url.php (checked against 7.5.28).
In getSchemes(), add a tel: option:
'mailto:' => 'mailto:',
'sftp://' => 'sftp://',
'ssh://' => 'ssh://',
'tel:' => 'tel:',
'tel://' => 'tel://',
In validate(), add a tel check right after the existing mailto check in the "no host" branch:
if (
isset($parsed_url['scheme'], $parsed_url['path']) &&
$parsed_url['scheme'] == 'tel' &&
in_array('tel:', $this->get_setting('allowed_url_schemes'))
) {
return true;
}
Keeping tel:// in the list avoids breaking existing field settings and entries. It could be deprecated or removed in a future major version.
Additional context
This has been around for years. It looks like tel was grouped with the hierarchical schemes (ftp://, sftp://, ssh://) when it belongs with mailto:.
Activity