Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124004 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 A94EE1A009C for ; Fri, 28 Jun 2024 23:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719617409; bh=QWrKveNeR88X9tS2ci89SigHgRoeJbfHdzI4dMsR7sQ=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=Od8Axae7OP8zp5tlxsvA1sJJ40FC/X9GYq4xj+9rdHN/TF0Mhv3D6DjshIB/jJYcW Y67ViLXK31MTtICf2yP3oC4i1G2tHBPOw0yPUmwPSXThHCnuK7VXwXBvTqFSrQTIwc 6VW/iT96SLqj+5bODYwdNQwWx/Frq8ZO4V1JhhrTRwamPVPio+LR4dCm9bqfN+sak1 AHIF9NFvb2T4IwHY2MU7OUWUMwgetBIwv3drztfl175bd3zoX2+HhiU2U0xJHR8UL4 7INhlNPS4MTT9WcXZRA0aDWKtjeYpGd8xXwMK2gr3wn1NSUm1yslaIwdPS4n1sbHEt C1x//QJBQ+kQg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C0FC1801E5 for ; Fri, 28 Jun 2024 23:30: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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,HTML_MESSAGE, MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (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 ; Fri, 28 Jun 2024 23:30:07 +0000 (UTC) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-64ac6015996so11189277b3.1 for ; Fri, 28 Jun 2024 16:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; t=1719617327; x=1720222127; darn=lists.php.net; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=7oBIEpcnskmJfWw1fkEfbPeo1r1qCWdS1vLUcy9R828=; b=IyPuNB/dJzJA5OUY0RO/mEs/upDnIJYPFiAU01WrgGIlvtUPP8C4j2SX7Nqt1AB2/g 3ONmqF1nehdE8+SLVKAbwEuYfzV4bbDdWQi+/1q9jvsp+itqpIGy/9PtOKcFaRznzuut vGaxm+o43S6R8hnr5NSZVPXh2CqHLs2k8kbTtXK+l90RpdqfrnhuN++RNKxv03JgKrPK RORpDvK6dPRE/j4GVO29uStmFCK+Juz/5FvPkWpu+w9mkW2o4E4/GzpVIdwPu4al0+5x 8zoEwP9kzvKLXBG+cOjbOhxK+NnmYyMrYK9GyNXiP6eCeT5dPdudo6E5yXdz9EKUSh3/ LmQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719617327; x=1720222127; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7oBIEpcnskmJfWw1fkEfbPeo1r1qCWdS1vLUcy9R828=; b=nUv6UzWqE6VCotWIpMVXDoBF2AeBRuoU1xwwz4aas9qQh3RGIxD1n4SSxfPFixUvVx /mm09TFR/uendoqB0cznD5wGYbvn8PkaH8UiLvXSURSBK54gL0fug16ZQ5etqarXWdpC QWHPa0fFjUhIxqveMya9VYmDU9Wac1pa7XRS8Oq5RaXNs3QjBHF611kZ437+EPY3YuSY XGXGfiB0bJ8EG5TJE7aEhByU5vshVJ1pOXhXQm36fIDnxWRhwVSbUzpmzk4VcfAQjLja 27NxPzuAd+qINfXwnFBrWAdfW8GcKozmjlGEUifDX2JBA+yuiRdczvwbhRaQegqIQmbn fXwg== X-Gm-Message-State: AOJu0Yx/nRASV+aXxFITxV4NkbGiCP2YS0kwnINCmb0EVFSwRwsEQgo/ TgCQPJRp3iP8OzdhxCrQPFV8h6RSHF5FjFk3MZR8OWxeN5iIJQv0exCSQiwnGbHZj6My2PR3C1V TmA== X-Google-Smtp-Source: AGHT+IERDdOLZNIqlKeSUiUcS/KWl0tYpVuB/BPJtra8Jwg1KXnQY4AZZyC5xODO15W0Jzw2tzqBNA== X-Received: by 2002:a05:690c:f0a:b0:643:9333:981f with SMTP id 00721157ae682-643ac913867mr199969357b3.50.1719617327236; Fri, 28 Jun 2024 16:28:47 -0700 (PDT) Received: from smtpclient.apple (h96-61-170-179.lvrgtn.broadband.dynamic.tds.net. [96.61.170.179]) by smtp.gmail.com with ESMTPSA id 00721157ae682-64a99c71a81sm5028537b3.14.2024.06.28.16.28.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Jun 2024 16:28:46 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-9F8AE4B0-FF6F-435B-8501-4C63F2E19673 Content-Transfer-Encoding: 7bit Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API Date: Fri, 28 Jun 2024 18:28:36 -0500 Message-ID: <2BFBF080-B17B-415E-87CE-4A68C34F06DE@benramsey.com> References: Cc: PHP Internals List In-Reply-To: To: =?utf-8?Q?M=C3=A1t=C3=A9_Kocsis?= X-Mailer: iPhone Mail (21F90) From: ben@benramsey.com (Ben Ramsey) --Apple-Mail-9F8AE4B0-FF6F-435B-8501-4C63F2E19673 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Jun 28, 2024, at 15:09, M=C3=A1t=C3=A9 Kocsis w= rote: >=20 > =EF=BB=BF > Hi Everyone, >=20 > I've been working on a new RFC for a while now, and time has come to prese= nt it to a wider audience. >=20 > Last year, I learnt that PHP doesn't have built-in support for parsing URL= s according to any well established standards (RFC 1738 or the WHATWG URL li= ving standard), since the parse_url() function is optimized for performance i= nstead of correctness. >=20 > In order to improve compatibility with external tools consuming URLs (like= browsers), my new RFC would add a WHATWG compliant URL parser functionality= to the standard library. The API itself is not final by any means, the RFC o= nly represents how I imagined it first. >=20 > You can find the RFC at the following link: https://wiki.php.net/rfc/url_p= arsing_api >=20 > Regards, > M=C3=A1t=C3=A9 The RFC states: The Url\Url class is intentionally compatible with the PSR-7 UriInterface. It mirrors the interface, but it can=E2=80=99t be swapped out for a UriInter= face instance, especially since it can=E2=80=99t be extended, so I wouldn=E2= =80=99t consider it compatible. I would still need to write a compatibility l= ayer that composes Url\Url and implements UriInterface. This makes it possible for a next iteration of the PSR-7 standard to use Url= \Url directly instead of requiring implementations to provide their own Psr\= Http\Message\UriInterface implementation. Since PSRs are concerned with shared interfaces and this class is final and d= oes not implement any interfaces, I=E2=80=99m not sure how you envision =E2=80= =9Ca next iteration=E2=80=9D of PSR-7 to use this directly, unless what you m= ean is that UriInterface would be deprecated and applications would type dir= ectly against Url\Url. Cheers, Ben --Apple-Mail-9F8AE4B0-FF6F-435B-8501-4C63F2E19673 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
= On Jun 28, 2024, at 15:09, M=C3=A1t=C3=A9 Kocsis <kocsismate90@gmail.com&= gt; wrote:

=EF=BB=BF
Hi Everyone,

I've been work= ing on a new RFC for a while now, and time has come to present it to a wider= audience.

Last year, I learnt that PHP doesn't hav= e built-in support for parsing URLs according to any well established s= tandards (RFC 1738 or the WHATWG URL living standard), since the parse_= url() function is optimized for performance instead of correctness.

In order to improve compatibility with external tools consu= ming URLs (like browsers), my new RFC would add a WHATWG compliant URL p= arser functionality to the standard library. The API itself is not final by a= ny means, the RFC only represents how I imagined it first.

You can find the RFC at the following link: https://wiki.php.net/rfc/url_parsing_api



The RFC states:

<snip>
</snip>

It mirrors the interface, but it can=E2=80= =99t be swapped out for a UriInterface instance, especially since it can=E2=80= =99t be extended, so I wouldn=E2=80=99t consider it compatible. I would stil= l need to write a compatibility layer that composes Url\Url and implements U= riInterface.

<snip>
This makes it possible for a ne= xt iteration of the PSR-7 standard to use Url\Url directly instead of requir= ing implementations to provide their own Psr\Http\Message\UriInterface imple= mentation.
</snip>

Since PSRs are concerned with s= hared interfaces and this class is final and does not implement any interfac= es, I=E2=80=99m not sure how you envision =E2=80=9Ca next iteration=E2=80=9D= of PSR-7 to use this directly, unless what you mean is that UriInterface wo= uld be deprecated and applications would type directly against Url\Url.

Cheers,
Ben

= --Apple-Mail-9F8AE4B0-FF6F-435B-8501-4C63F2E19673--