Skip to content

Uri\WhatWg\Url host validation when using withHost #19913

@nyamsprod

Description

@nyamsprod

Description

The following code:

<?php
echo new Uri\WhatWg\Url('data:toto')->withHost('example.com')->toAsciiString();

Resulted in this output:

data://example.comtoto

But I expected this output instead:

an InvalidUrlException to be thrown

data URL are URLs with opaque path. URLs with opaque path always have a host which is null

tested using https://3v4l.org/J9IHN/rfc#vgit.master

PHP Version

Runtime: PHP 8.5.0-dev

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions