Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126520 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 qa.php.net (Postfix) with ESMTPS id D616B1A00BC for ; Thu, 27 Feb 2025 21:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1740689949; bh=s8JJCaRa2Msvw348idfehB4vdMpNu0JRJz4n87kc3Dk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=afr1Eb8AXW5pqE9MoSMhi327hyVTblPBg08GzXh1DJ+8Vl3SpG3Dfo+GEU4ab9hsn JojmtEdN9qiaLC4A6SajKO8GarVM566sDlP3vlXwjSyLhLiwU3j4DudUUlLn9KAyiv cIp2dRZ30OEmTiO/1iWvqEGF9gVj+YtDnk6c/RlX3iIn0NFpUng3thGtyF+xJVdRFU NYaR3TDSf4Ss4nZVeps+jc5LBIps+459KlDTSKusAnIoH24/bARmWj+X3tCj2S7yD0 b+InciwYK0RJR6CHGc16O320RtedfEUPEmNJDUxnW7Pu6WqFHP1QmsmvLtGFa2W7cL AAarKUt+dpNxw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 928E9180034 for ; Thu, 27 Feb 2025 20:59:07 +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=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,URIBL_SBL_A autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from sender4-of-o54.zoho.com (sender4-of-o54.zoho.com [136.143.188.54]) (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 ; Thu, 27 Feb 2025 20:59:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1740690090; cv=none; d=zohomail.com; s=zohoarc; b=d0DDlXUj6Nklw2jAj4PpJJ10jvksB+D38Q35MnVEqYyO3DMNLYAb40PnKl4gALutgHquOSpTa+RZDAuU2XHrMD/GgL75GXormtO9HAbZeQ7cD0FRqQ5MaYtIRn3WDu1YkhhdUvuYKk4pErr1/rO7uNflliRUVi/m1RBBx4MgH6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740690090; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=s8JJCaRa2Msvw348idfehB4vdMpNu0JRJz4n87kc3Dk=; b=ZNcvMI64JycR5GtnkLkDulquhnWd6MpIhe1xyCOqUXMYBuaWsdaBEymeUY0LJbMHGOfBZYfSSgTd4Z4R70dpawoZmBLtx/2v3D/Ruz9i6xGE41Br6G3TstA48VL0SiYn4kNWncUfukCsVBbCeBRjDo86ml3Q+iVHKu1I7IrUk+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=faizanakram.me; spf=pass smtp.mailfrom=hello@faizanakram.me; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1740690090; s=zoho; d=faizanakram.me; i=hello@faizanakram.me; h=MIME-Version:References:In-Reply-To:From:From:Date:Date:Message-ID:Subject:Subject:To:To:Cc:Cc:Content-Type:Message-Id:Reply-To; bh=s8JJCaRa2Msvw348idfehB4vdMpNu0JRJz4n87kc3Dk=; b=DWrgQ8pq4ZBivmiu2pUJSqKPuWQEv+omg8GtjDXJntHyYd7NTPaMoW1gDd3DcfkV igazCuSGa+mM4DetSlRXSXgOzbWA/IEgHhMmIZp9jC4FEIPAxFpBin7kPkglu+iK6h1 LN9db08AudQQHbNO8pc6hc7ZIlApajvQ5bj3xAHY= Received: by mx.zohomail.com with SMTPS id 1740690082468296.2690339273918; Thu, 27 Feb 2025 13:01:22 -0800 (PST) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-6fba8e84d3cso12804727b3.0 for ; Thu, 27 Feb 2025 13:01:22 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWvRt1bRoGxFQKXrlP2g3SUQP0ZSp3kOZrHMVLI920e4sRN9wJJA8hQ3gQ0D4sjko8IIqlYNqG0nU0=@lists.php.net X-Gm-Message-State: AOJu0YxQBgw5Y7/9H8rU4RAZSQcOhVVhlXZxjA+7I1AahZW/Jk3WOz63 PeIQkNg6beoXVEBrzZiWPDPXhytpyR0eCQqUJO9VW3X8CQ05DkfElHWCfggiEv6eBiQtz2ye2jC KqvF7YONEnMGVPyuwQUqmj9QDsd0= X-Google-Smtp-Source: AGHT+IG3rhZhko6fXR2VOXBSW/9fXqWeBPjaIYk7Jo5AD/VxDfbVgcKAkpCAxZWtuE8ddXg2zFuE30rz7rQrfaiOie0= X-Received: by 2002:a05:690c:6489:b0:6f9:4a4d:1fa1 with SMTP id 00721157ae682-6fd4a06521cmr16330027b3.9.1740690081901; Thu, 27 Feb 2025 13:01:21 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <811B65CE-1DF0-4A47-937C-4FCB6E945B92@pmjones.io> <19377F60-FB7F-4E6E-A085-4DCB6CD92234@pmjones.io> <7B7987C6-37F3-432A-8BA2-9D93F428FAD5@pmjones.io> In-Reply-To: <7B7987C6-37F3-432A-8BA2-9D93F428FAD5@pmjones.io> Date: Thu, 27 Feb 2025 22:01:10 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: AQ5f1JoQCMuAFhMwQX9jXAbdHGczbQnWJeAE8kDza5h1rq8DD6i2_k-8KGfW86Q Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API To: "Paul M. Jones" Cc: nyamsprod@gmail.com, =?UTF-8?Q?Tim_D=C3=BCsterhus?= , "Gina P. Banyard" , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000ff00f6062f25fdce" X-ZohoMailClient: External From: hello@faizanakram.me (Faizan Akram Dar) --000000000000ff00f6062f25fdce Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, 27 Feb 2025, 20:55 Paul M. Jones, wrote: > > > On Feb 25, 2025, at 09:55, ignace nyamagana butera > wrote: > > > > The problem with your suggestion is that the specification from WHATWG > and RFC3986/3987 are so different and that the function you are proposing > won't be able to cover the outcome correctly (ie give the developper all > the needed information). This is why, for instance, Mat=C3=A9 added the g= etRaw* > method alongside the normalized getter (method without the Raw prefix). > > The two functions need not return an identical array of components; e.g., > the 3986 parsing function might return an array much like parse_url() doe= s > now, and the WHATWG function might return a completely different array of > components (one that includes the normalized and/or raw components). > > All of this is to say that the parsing functionality does not have to be > in an object to be useful *both* to the internal API *and* to userland. > It most definitely needs to be an object. Arrays are awful DX wise, there is array shape which modern IDEs like phpstorm support and so does static analysis but the overall experience remains subpar compared to classes (and objects). > Recall that I'm responding at least in part to the comment that > "Considering that one of the other stated goals of this RFC is to provide > this API to other core extensions, the previous objections [to the > Request/Response objects going into core] do not apply here." If the only > reason they don't apply is that the core extensions need a parsing API, > that reason becomes obviated by using just functions for the parsing > elements. > > Unless I'm missing something; happy to hear what that might be. > > > -- pmj > Imho Request and Response objects do belong in core, but with a very good api, something which would replace http foundation/PSR7 altogether. > --000000000000ff00f6062f25fdce Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,


On Thu, 27 Feb= 2025, 20:55 Paul M. Jones, <pmjones@pmjones.io> wrote:
=

> On Feb 25, 2025, at 09:55, ignace nyamagana butera <nya= msprod@gmail.com> wrote:
>
> The problem with your suggestion is that the specification from WHATWG= and RFC3986/3987 are so different and that the function you are proposing = won't be able to cover the outcome correctly (ie give the developper al= l the needed information). This is why, for instance, Mat=C3=A9 added the g= etRaw* method alongside the normalized getter (method without the Raw prefi= x).

The two functions need not return an identical array of components; e.g., t= he 3986 parsing function might return an array much like parse_url() does n= ow, and the WHATWG function might return a completely different array of co= mponents (one that includes the normalized and/or raw components).

All of this is to say that the parsing functionality does not have to be in= an object to be useful *both* to the internal API *and* to userland.



It most definitely needs to be an object. Arrays are awful DX= wise, there is array shape which modern IDEs like phpstorm support and so = does static analysis but the overall experience remains subpar compared to = classes (and objects).=C2=A0



Recall that I'm responding at least in part to the comment that "C= onsidering that one of the other stated goals of this RFC is to provide thi= s API to other core extensions, the previous objections [to the Request/Res= ponse objects going into core] do not apply here." If the only reason = they don't apply is that the core extensions need a parsing API, that r= eason becomes obviated by using just functions for the parsing elements.
Unless I'm missing something; happy to hear what that might be.


-- pmj

Imho Request and Response objects do belong in core, but with a very = good api, something which would replace http foundation/PSR7 altogether.
--000000000000ff00f6062f25fdce--