Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126728 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 CC5221A00BC for ; Wed, 12 Mar 2025 22:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741816681; bh=Nqzf/RJqFYeAJqIUUE5COTe8IK/F4eGM5yVCn4uCvTc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VMtoQ1Ya1FMOp5cBF3x+hcfp4Evn4aE8AVpqt96+7sXvnRkCjxwwhYeAAfQ+kUIqC Rm7+9a+HaMSZuNVmINA3j8oXF+L37hTiR4aFsWZBciW3jLXmjmeOpH41OrwQhETOlC pNFEk7RMj7u1Vu/EVk9fHEqr1QyfuxQpA+GwR0+HnylJnWriMz3RZe7P/ZkiA/54fY eHAqkfpSgy1wIaSTDX3xPldZLyPUisAdqqexDFE8NNOdiKf77TATDz80NB6u8efgUO 0BxDSY0qvnDaLTQhRKk2iji3j72Cq0Uhtib4rsHksQ8xSRG8tl5Nmvib2dqBb9CMG2 7IHp3HZBwqJDw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED17B18003C for ; Wed, 12 Mar 2025 21:57:59 +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.1 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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, 12 Mar 2025 21:57:59 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-476a720e806so2622311cf.0 for ; Wed, 12 Mar 2025 15:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741816832; x=1742421632; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Nqzf/RJqFYeAJqIUUE5COTe8IK/F4eGM5yVCn4uCvTc=; b=F7kHr7kmZTGrN6yYL+TItz+QUMJ+PGiN9eVx+SFTWomLxYtKBNyQrOLfXhSqqFTrZY xoP4PQORAxfOtFiFFuWNcDQb4qtaasTnlbtwDSFhsDO0pGWSLMX5r5MAsH8oU8D/wlDa RhKbePfDGSTRUzYudQ52qwzCtgOVTeVR/S9nmt42s6MOLwuyZw2tD7k4E5ZNxRrZfgUS UXzbhjbcNvuLxgHaPM/xf07K6VrdOF0gENoO2JkAuTg74WaaNZebUET7iWjRN4/MruyF QE0kvdakf4lJAWvkFd3PrsZDoAEtZXxU2lvRWg6znxwaNVAK96yI1hGjz3b9WRxgmICl M5EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741816832; x=1742421632; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nqzf/RJqFYeAJqIUUE5COTe8IK/F4eGM5yVCn4uCvTc=; b=dfCpc6PwDVWBSufhSgr7E3qq89YZhEdvAMayE+cz1T8Wl2C4bK9gwXehR55P9HReHd 0eCV+35S4/pgLWf3tFqWdTzDY3LIZB6xdtrLUavaFa9AnqpEpGjTgn76KLBw/w9ecdzg sysl8xE66f4s6/Wk6pHxS7u13Kg5LrfNRYcYqHyfSTSHGbFHJobWXQI9WGqgJ4u5XqND 9ZKciRghUANAh8/w4LkTNYyhhfCR7dnd08L9PbP96kQT4ZAvu/S/NTynjmGCA2eVuf/m Uw461EBhOQ2MkNZu+QYDKeULHI8Luc+rjKteVAy4wAXeJiRnGCGg23Udi+dq4UL8X0FK Qdqg== X-Forwarded-Encrypted: i=1; AJvYcCXrZQFPi0SLc5k48HbfRYtoVZrLtah5ESQXRtR2bUJbW7h4zCGyBrWXjMqrrScnkLYGJcGyniQT4Ck=@lists.php.net X-Gm-Message-State: AOJu0YzqCCWWESu75JEjfSb3aIwl560ZsZ/cqh9gJwTHm9A6OpTD5JhV mYNJzYEwrF8KzBADH0lXUcBH9HV9x6vHqUU8PPLsttCk7iHaFS/ERvtiSvtUS+aG+yRFRqXYR2j Hpq1Cebjv6Jh/k3F6zuZNVTushcFC6cOEJuHltQ== X-Gm-Gg: ASbGnct3Hb213SyNMyRYvZhX3T1XGvOJkHivt3q3Tl0GNKONQRbzru/1CaP/eC5bK4O /3ShcTvj3WiiWQFrvPGXglo/38qnpCTQ4aBh92cwT1y3EDIC6cbY1+AcYVGT7ob67uYz923DqGB ZqOSfdwf07O/DbE1FQ6D+/1GiOKg== X-Google-Smtp-Source: AGHT+IFLyGkyErisogfH1S//DWHkPeU/wY+Uhe9zHjiSqiAK6DFT7nqkP5ZAfp4b2xXnyXhAcJfvBXcrGycHo99itBE= X-Received: by 2002:ac8:7d16:0:b0:476:671e:deb6 with SMTP id d75a77b69052e-476994c5f5fmr116752471cf.12.1741816832371; Wed, 12 Mar 2025 15:00:32 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <17bdbfa35c920a86a19690e356e05f99@bastelstu.be> In-Reply-To: <17bdbfa35c920a86a19690e356e05f99@bastelstu.be> Date: Wed, 12 Mar 2025 23:00:21 +0100 X-Gm-Features: AQ5f1JruTpDcl269LZTk6YjLkTgVwaxzg7mOD_d6dabnZNnwTtixnz_WWp8Daiw Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: "Gina P. Banyard" , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000008eb1a906302c55f2" From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --0000000000008eb1a906302c55f2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tim, > The same is true for `UriOperationException`. The RFC says that it can > happen for memory issues. Can this actually happen? My understanding is > that the engine bails out when an allocation fails. In any case if a > more graceful handling is desired it should be some generic > `OutOfMemoryError` rather than an extension-specific exception. > After checking the code of emalloc et al. I agree with you, the exception won't actually be thrown for memory errors. Therefore, I removed this part of the RFC. > > With regard to unserialization, let me refer to: > https://externals.io/message/118311. ext/random uses `\Exception` and I > suggest ext/uri to do the same. This should also be handled in a > consistent way across extensions, e.g. by reproposing > https://wiki.php.net/rfc/improve_unserialize_error_handling. > Thanks for bringing this RFC to my attention, I agree with the motivation, so I changed this aspect of the RFC too to throw an \Exception. > > And with =E2=80=9CTheoretically, URI component reading may also trigger t= his > exception=E2=80=9D being a theoretical issue only, the `UriOperationExcep= tion` > is not actually necessary at all. > I wanted to reserve the right for any 3rd party internal URI implementation= s to fail for whatever reason that prevents reading. The built-in implementations don't fail for sure, but it doesn't mean that 3rd party implementations neither will. Since potential errors can be handled in some way, I think it makes sense to keep this exception, especially because it's now basically non-triggerable. I'm not sure if I'm entirely correct, but it's possible that a 3rd party URI implementation won't (or cannot) use PHP's memory manager, and it relies on the regular malloc: in this case, even memory errors could lead to failures. Regards, M=C3=A1t=C3=A9 --0000000000008eb1a906302c55f2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Tim,
=C2=A0
The same is true for `UriOperationException`. The RFC says that it can
happen for memory issues. Can this actually happen? My understanding is that the engine bails out when an allocation fails. In any case if a
more graceful handling is desired it should be some generic
`OutOfMemoryError` rather than an extension-specific exception.

After checking the code of emalloc et al. I agree = with you, the exception won't actually
be thrown for memory e= rrors. Therefore, I removed this part of the RFC.
=C2=A0

With regard to unserialization, let me refer to:
https://externals.io/message/118311. ext/random uses `\Exce= ption` and I
suggest ext/uri to do the same. This should also be handled in a
consistent way across extensions, e.g. by reproposing
https://wiki.php.net/rfc/improve_unserial= ize_error_handling.

Thanks for brin= ging this RFC to my attention, I agree with the motivation, so I
= changed this aspect of the RFC too to throw an \Exception.
=C2=A0=

And with =E2=80=9CTheoretically, URI component reading may also trigger thi= s
exception=E2=80=9D being a theoretical issue only, the `UriOperationExcepti= on`
is not actually necessary at all.

I wan= ted to reserve the right for any 3rd party internal URI implementations
to fail=C2=A0for whatever rea= son that prevents=C2=A0readin= g. The built-in implementations
don't fail for sure, b= ut it doesn't mean that 3rd party implementations neither will.
Since potential errors can be handled in some way, I think it makes sens= e
to keep this exception,=C2=A0especially because it's now ba= sically non-triggerable.

I'm not sure if I'= ;m entirely correct, but it's possible that a 3rd party URI implementat= ion
won't (or cannot) use PHP's memory manager, and it re= lies on the regular malloc:
in this case, even memory errors coul= d lead to failures.

Regards,
M=C3=A1t=C3= =A9

--0000000000008eb1a906302c55f2--