is_valid_url() accepts httpx:// and rejects uppercase HTTP://

Aperta
#1,546 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@elphizu ci sta già lavorando.

Dal 17/11/2026.

  • #1547 di @elphizu — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
php
Ambito
testing-qa

Direzione di ricerca

Read includes/Traits/URL_Utils.php around is_valid_url() and inspect the tests for URL validation. Add cases for uppercase and mixed-case HTTP schemes and for httpx:// and httpfoo://, then run the relevant tests. Done means valid HTTP schemes are accepted regardless of case and schemes beginning with http but not equal to HTTP or HTTPS are rejected. A pull request is already open for this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

is_valid_url() in URL_Utils.php tests the raw string with str_starts_with( $url, 'http' ). That check is case-sensitive and only looks at the first four characters, so:

  • httpx://example.com/ passes, because it starts with http.
  • HTTP://example.com/ fails, even though schemes are case-insensitive (RFC 3986).

The function is used for Plugin URI, Author URI and the readme Donate link.

Proposed Fix

Drop the prefix check and compare the lowercased parsed scheme to http and https. Add test cases for HTTP://, HtTpS://, httpx:// and httpfoo://.

Steps to reproduce
  1. Set Plugin URI: HTTP://example.com/my-plugin in a plugin header and run Plugin Check. It reports an invalid URL.
  2. Change it to httpx://example.com/my-plugin or httpfoobar://example.com/my-plugin and run again. No error.
Environment

Plugin Check trunk (2.1.0-alpha), WordPress 6.3+, PHP 7.4+.

Lingua principale
PHP
Stelle
365
Fork
135
Merge medio
1g 8h
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WordPress/plugin-check

Tutte le issue di WordPress/plugin-check

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.