Skip to content

ext/uri: Percent-encoding of caret in WHATWG URL paths is not performed #22628

Description

@JKingweb

Description

The following code:

<?php
$url = new Uri\WhatWg\Url("https://example.com/^");
var_dump($url->getPath());

Resulted in this output:

string(2) "/^"

But I expected this output instead:

string(4) "/%5E"

The URL standard states:

The path percent-encode set is a percent-encode set consisting of the query percent-encode set and U+003F (?), U+005E (^), U+0060 (`), U+007B ({), and U+007D (}).

This is tested in two (incorrect) tests: whatwg/parsing/path_success_percent_encode_set2.phpt and whatwg/modification/path_success_auto_encoded.phpt.

PHP Version

PHP 8.5.8 (cli) (built: Jul  1 2026 16:35:50) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.5.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.8, Copyright (c), by Zend Technologies

Operating System

Arch Linux

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions