[php-src] Issue #22628: ext/uri: Percent-encoding of caret in WHATWG URL paths is not performed

[email protected] (JKingweb) Tue, 7 Jul 2026 14:18:43 +0000
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/22628
Author: JKingweb

### Description

The following code:

```php
<?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](https://url.spec.whatwg.org/#path-percent-encode-set):
> 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](https://github.com/php/php-src/blob/4afc970827a038e380551cc97e9a14493cae0854/ext/uri/tests/whatwg/parsing/path_success_percent_encode_set2.phpt) and [whatwg/modification/path_success_auto_encoded.phpt](https://github.com/php/php-src/blob/4afc970827a038e380551cc97e9a14493cae0854/ext/uri/tests/whatwg/modification/path_success_auto_encoded.phpt).


### PHP Version

```plain
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