Skip to content

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

Closed

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

Activity

  1. added 2 commits that reference this issue on Jul 12, 2026
    60fe63c
    c025bc4
  2. added a commit that references this issue on Jul 12, 2026
    b84bd9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions