URL Fieldtype wants incorrect `tel://` protocol instead of `tel:`

Offen Anfängerfreundlich
#5,453 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
83/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
php
Bereich
backend, web-dev

Rechercherichtung

Beginne mit system/ee/ExpressionEngine/Addons/url/ft.url.php, insbesondere mit getSchemes() und dem validate()-Zweig ohne Host in der Nähe der vorhandenen mailto:-Prüfung. Sieh dir die Tests für den URL-Fieldtype an, falls vorhanden, und ergänze Tests dafür, dass tel: akzeptiert wird, wenn es aktiviert ist, während die vorhandene Einstellung tel:// erhalten bleibt. Fertig ist die Änderung, wenn standardmäßige tel:-Werte validiert werden, sofern dies erlaubt ist, und das bestehende Verhalten kompatibel bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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 when tel:// 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

  1. Create a URL field.
  2. In the field settings, check tel:// under "Allowed URL schemes."
  3. Edit an entry and enter tel:+15555551234 in the field.
  4. Save. Validation fails with the invalid URL scheme error.
  5. Change the value to tel://+15555551234 and save. It passes, but it's an invalid tel URI.

Screenshots / Videos / Template Code

URL fieldtype protocols

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:.

Vorherrschende Sprache
PHP
Sterne
505
Forks
135
Ø Merge
3 T. 7 Std.
Gemergte PRs (30 T.)
7

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ExpressionEngine/ExpressionEngine

Alle Issues in ExpressionEngine/ExpressionEngine

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.