Skip to content

url: no dot after the host, ports of 1-5 digits (LIVR 2.5) - #41

Open
koorchik wants to merge 1 commit into
masterfrom
url-2.5
Open

koorchik wants to merge 1 commit into
masterfrom
url-2.5

Conversation

@koorchik

@koorchik koorchik commented Nov 8, 2026

Copy link
Copy Markdown
Member

This PR applies the LIVR 2.5 url fix (koorchik/LIVR#98), which was added to the specification after #40:

  • a dot after the host gives WRONG_URL (https://www.google., https://example.com./path, http://192.0.2.1./);
  • a port has 1–5 digits: https://example.com:8a, :+80 and an empty port now give WRONG_URL (FILTER_VALIDATE_URL read them as numbers);
  • host labels of up to 63 characters and ports up to 65535 were already checked by FILTER_VALIDATE_URL, so nothing changes there.

The rest of the rule is unchanged. tests/test_suite_2.5 is copied from the LIVR repository again (new cases in */36-url), a unit test covers the port and host cases, and the README lists the change.

The change was prepared with the help of an LLM and tested: PHPUnit and phpcs pass on PHP 7.2–8.5, the versions of the CI matrix. Thank you for reviewing it!

LIVR 2.5 amends the url rule (koorchik/LIVR#98): only a port, a path, a
query or a fragment may follow the host, a label of the host has 1-63
characters, and a port has 1-5 digits and a value of 0-65535.

FILTER_VALIDATE_URL already rejected labels longer than 63 characters and
ports above 65535, and accepted one-digit ports. It accepted a dot after
the host (https://www.google., https://example.com./path) and a port with
other characters (:8a, :+80, an empty port), which the url rule now
rejects. The rest of the rule is unchanged.

The LIVR 2.5 test suite is copied from the LIVR repository again, with the
new cases in test_suite_2.5/{positive,negative}/36-url.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant