Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130651 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 3D5851A00BC for ; Wed, 15 Apr 2026 20:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776284488; bh=lT6TE+PBPiSH3PtBwL/hjLalTPS9Ki3Ttel89/agMZM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SHWA3k1GpTfq68BThvCqkh4VCpuE9TOXO5bdFhziY+FirM95WBCAKcwvUZj4zcS/l 6AZol7SZqWicDWSWVP8uCnBUsROfii/TxPC72acbly5kftnKnjmFMRWkRbttWMYAdB tL/j7+FIhVaKlv2IAbps8mHD4MLtqzEGj9jQV+n2fh8bJ1hKrgHeb3pojdHnQckxxI cfOj0IvEILLt7waqvqLf0Gu60E8u8SuQUp3rVaXAvl0cHveNUk6KiyQGC+IeVjDK1E gSDHRcaRwpbGt/rniricf2/+xvmoNn9mWHPFzeui/oGWF8FOilXKQqVzcfGYo12XN+ N4mla6QY+cQ1w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 22040180069 for ; Wed, 15 Apr 2026 20:21:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 15 Apr 2026 20:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1776284481; bh=4VDBBG84mbheSyu0Ni88o84iymNwWjUdDTbU5RdSFx4=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=XETl2lLU98UTDdLPin2WWq98ICtSl603R+5esHej24136KHwztCdFHc17JIokMkcG bDmLfFuUX7ezmJK9okvUBZh6Ts0EAH4sVwcnTAvIKv8XNLhdg6vWkv640bgxub8Dd0 xbsUysqlHi78A4E6Wxs9oPMbx7icU9tyU63cdQ7jHGy9nrmljgO9nIejOhqEARqsmb 51e5UvLC4b4GbFz1c9X0ztNeVbPjfA0QPmhOTEDmbrVAZLyCDQRNuGR2gKKHyi7PJz 0D0E0QXMfCx16+c6qHgxjJJQmpSPNHDx1UaSORJ5ncE0NFsQzy0wEUKkTKSdRecwRC p8jm15AldX5yQ== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 15 Apr 2026 22:21:20 +0200 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri In-Reply-To: References: <83238ad3-c844-4457-dfb3-11321787e022@php.net> Message-ID: <4643495923b044673383e38c68beca73@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2026-04-15 22:04, schrieb Larry Garfield: > For host type detection, what does a null return signify? UrlHostType > includes an Empty case, which I'd assume would be used in that > situation. And I'd rather have an Empty case on UriHostType as well > rather than null, unless someone can make a good argument for using > null instead... An empty host is semantically different from a missing host. You can check that with the existing functionality in PHP 8.5, where `getHost()` is `?string` for both RFC 3986 and WHATWG URL in accordance with the respective standards. If `getHostType()` will return `null` if `getHost()` returns `null`. The cases of the Ur[il]HostType enums in the featured RFC are also pulled straight from the respective specifications. > LeadingSlashPolicy::AddForNonEmtpyRelative is... a mouthful. > Self-documenting is fine, but as the example demonstrates it quickly > creates super long lines. That could be a problem in, say, a match() > statement, inside a method, where with that enum value as a case you'd > be more than halfway across the screen before you get to the executable > code for that case. Is there no way to make that whole thing shorter? FYI: I've also had little time for this RFC, but I've started discussing spinning off the “path segment” part of the RFC into a dedicated RFC with Mate off-list a few days ago, similarly to how the query parameters part has been spun off because it has become too complicated for a bulk RFC. > I'm not sure how I feel about object methods on the enum. That would > be something like: > > use Uri\Rfc3986\PercentEncoder; > > PercentEncoder::Path->encode($someval); > > Right? […] Yes. > use Uri\Rfc3986\encode; > > encode($someval, PercentEncoder::Path); > > Is about the same length, and with PFA easily pre-configurable, and > closer to what is typically seen in the wild today. FWIW: The enum would also be “pre-configurable” with https://wiki.php.net/rfc/partial_function_application_this. Arnaud and I are working on a more general version of that RFC based on Bob's feedback, but will need to figure out the latest edge cases before proposing it. Best regards Tim Düsterhus