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

未关闭
#1,546 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@elphizu 已经在做这个了。

开始于 2026年11月17日。

  • #1547 来自 @elphizu —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
php
领域
testing-qa

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
PHP
星标
365
派生
135
平均合并
1 天 8 小时
30 天内合并 PR
20

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WordPress/plugin-check 的其他 Issue

查看 WordPress/plugin-check 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。