[php-src] Issue #20366: ext-uri when to throw ValueError vs InvalidUriException

From: Date: Sun, 02 Nov 2025 18:51:10 +0000
Subject: [php-src] Issue #20366: ext-uri when to throw ValueError vs InvalidUriException
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251164@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20366 Author: nyamsprod ### Description The following code: [test](https://github.com/php/php-src/blob/master/ext/uri/tests/035.phpt#L21-L25) Resulted in this output: ``` Currently the tests returns a ValueError ``` But I expected this output instead: ``` Uri\WhatWg\InvalidUrlException: The specified URI is malformed; Invalid URL (DomainInvalidCodePoint) ``` To me both are acceptable, I would lean toward the second options which is what the WHATWG URL standard would expect but I understand the current output. I just want to know if there is a clear guideline when to throw a ValueError vs InvalidUrlException because from a DX usage it may mean that withers can only throw ValueError ? 🤔 ### PHP Version ```plain using php master branch (but this is irrelevant) ``` ### Operating System _No response_

« previous php.bugs (#251164) next »