Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127227 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 1CE6D1A00BC for ; Mon, 28 Apr 2025 19:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745869751; bh=ZuQo2eAAxkfzy5vISWvGTNGPTs1NdZdWMzWnPXjaTtw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=BXpEWJhCaGCP8QaiOiUGTaoDOMe8iD9Su/N9bbs87o6tiyfn93qzVl7doKJ57EBeT uIbCVUCseV7djiwXJV9dcveEhHikTzi9aepA++H6PMqW7kqX1JLVhPY0Vnem+zscJg o36ii1kS/odoQRhL/AXGK4TK85ur6Jy8S8Puyhw4ovjwr5AZsYGFOoxJPlxJzpDJ3Q YlaE7KaKK1KFb7vyfUDuyrH/6g91V8M6m79ZVfcFEUEzfUmo5E+6al3mYRk9KZdk/l ijTfXlxXvxhC7yfd2UgmXj6797XeHXEs4N4C8Dt4SaiyNPD+IIedtq76yxcTD8uRhq vrr7ZLazcr6zw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 13052180577 for ; Mon, 28 Apr 2025 19:49:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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_MISSING,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from premium76-5.web-hosting.com (premium76-5.web-hosting.com [162.213.255.108]) (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 ; Mon, 28 Apr 2025 19:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pmjones.io; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=ZuQo2eAAxkfzy5vISWvGTNGPTs1NdZdWMzWnPXjaTtw=; b=HyId9Fq0LVcXo0KCiWrKCQio1g SDdHz2xkSSP85wxukmT6LC8Kk3Z4HrZG2soQQGC+UPfUkWxSnC1UiWkmlM4FBCz1PLkSqI9kgr0qA CnEHWHFtrO6uFXWtYEyHtd5njjrSuM4xwE1XjiL1HVCfC5enXcs7h+/21vmSo4KAluKOiz6C/Gpgq c1COEtFONwkTDvDmr2I4CqKlRjvkL7a8y8iEdTb0U4yyDDMPmr1DfWK1+oSwCsw/s63f/Y1OD2zdC WAeCdnMGmJzKobZVY5bo87iPyOOteWFEe0rfc+hsbR0FJTaClS3BR6h8S+JOQCRhiHF2YLEv93H0x XnvX5rKg==; Received: from 107-223-28-39.lightspeed.nsvltn.sbcglobal.net ([107.223.28.39]:51228 helo=smtpclient.apple) by premium76.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1u9UVh-0000000ED8f-19KB; Mon, 28 Apr 2025 15:51:25 -0400 Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API In-Reply-To: Date: Mon, 28 Apr 2025 14:49:24 -0500 Cc: Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <1BCB4144-231D-45EA-A914-98EE8F0F503A@automattic.com> <8E614C9C-BA85-45D8-9A4E-A30D69981C5D@automattic.com> <8df04e01-deac-404b-beb7-cd982423db63@bastelstu.be> <33427cd03035ef084245c44290b56a55@bastelstu.be> <0aa1eefc3941bdea0092e935074daa58@bastelstu.be> <76d96ea8a78c6025128c0a4b01c94c0a@bastelstu.be> To: =?utf-8?B?TcOhdMOpIEtvY3Npcw==?= X-Mailer: Apple Mail (2.3826.400.131.1.6) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium76.web-hosting.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pmjones.io X-Get-Message-Sender-Via: premium76.web-hosting.com: authenticated_id: pmjones@pmjones.io X-Authenticated-Sender: premium76.web-hosting.com: pmjones@pmjones.io X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched From: pmjones@pmjones.io ("Paul M. Jones") Hi Mat=C3=A9 and all, > On Apr 27, 2025, at 16:47, M=C3=A1t=C3=A9 Kocsis = wrote: >=20 > Hi Tim, ... >> So it seems to be safer to use the naming without the `raw` and then = in=20 >> the documentation explain what happens with useful examples, just = like=20 >> the RFC already does. >=20 > We discussed this off the list, and the recommendation made sense to = me at last. I am glad to see it! * * * Removing the `raw()` methods from the Whatwg\Url class opens up another = opportunity. The Rfc3986\Uri `raw()` methods present a departure from existing = userland expectations when working with URIs. No existing URI package = that I'm aware of retains the normalized values as their "main" values; = the values are generally retained-as-given (i.e. "raw"). Nor do they = afford getting two versions of the retained values (one raw, one = normalized). This might be solved by renaming the Rfc3986\Uri methods so that the = "main" methods return the raw values, and the alternative methods return = the normalized versions. For example, getPath() would become = getNormalizedPath(), and getRawPath() would become getPath(). But that's pretty verbose, and on considering it further, I think I = think there are two classes combined inside Rfc3986\Uri. Proposal: Instead of a single Rfc3986\Uri class that tries to hold *both* raw = *and* normalized values and logic at the same time, introduce a = NormalizedUri class to operate with normalized values, and treat the = current Uri class as operating with raw values. That would, among other = things: - fulfill existing userland expectations; - eliminate the getRaw() methods; - replace the toString()/toRawString() with a single idiomatic = __toString() in each class; - move normalization logic into the NormalizedUri class. Optionally, there could be one additional method one or both classes, = toNormalizedUri(), to create and return a normalized instance. For Uri = the return would be a new NormalizedUri; for NormalizedUri, the return = would either be itself ($this) or a clone of itself. If the RFC pursues that approach, it will also lend itself to either an = abstract they each extend or (preferably) an interface they each = implement. If an interface, I opine it should be called Uri; the current = Uri class might become RawUri (with NormalizedUri not needing a rename). Thoughts? -- pmj