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

Đang mở
#1,546 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@elphizu đang làm issue này rồi.

Từ ngày 17/11/2026.

  • #1547 của @elphizu — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
PHP
Star
365
Fork
135
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WordPress/plugin-check

Tất cả issue của WordPress/plugin-check

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.