Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130137 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 8019D1A00BC for ; Mon, 23 Feb 2026 16:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771865778; bh=bwu1KD4+jQSpOUzoynjtkGmBfYMRz7ex0/V/SKTgPk8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IiNg+yI1ZwlJGhaV9vt7G+KhSGxHX92frf96FPlyg3Mdib2Oc1U5ld7PlxV6dy+CZ dc2wudNvO3/D/ijnRIBe9VtU8PbzlSRTFmAkpkBJPWMRRhE3z0s3FQl+UI8apT2kqA VyBMqj8u1z95fAmc1aCyn6Ab3hlEM/q/1zEkqtZ2TRR7x92DgUDH6oV5zX50fLNjtd +/+4WgY+08WPUep0DsAtHnOl0VzpvYxLg6wuCdUWYa32H3Igv89TfWesFuNiaMkX8d Fy4OUtylP+QtzSLG6LQeaVRJXPMdkzfltVnEef6syfr/BynHOM00RYFgcfQzVcYCnj CwG49SSU8/plQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C26271801D6 for ; Mon, 23 Feb 2026 16:56:17 +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=1.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FORGED_GMAIL_RCVD,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.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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, 23 Feb 2026 16:56:17 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7d4be94eeacso3827066a34.2 for ; Mon, 23 Feb 2026 08:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771865772; cv=none; d=google.com; s=arc-20240605; b=GEUJ4pQ0I8s81onysS/mRnH5AfQ/ls8le0Ra8v3vf2AAhE5E3CtXLZQRSMsdtdaOWi X86cHEeCuXifvGJKc/oXFEAQJieL4fLmoTEc0l0vteiD1QxaqNtu31Jp8DSwx5EIvJ+M ZEJ7cfl/kuJqPTDADD385OjNHsBvvIxUwLJ0+Ctm8pOyEi4akDap4kQc6NIJi0ONry5X Cr7hHZByK6N1f8/vyixjHlsZPo2I2A9cSv9PbfvWGn6mcHw58ThS73QQ8XaK1jMbwo7K jjxOxTpRUotwprKEkTCOZwO1FhUORP3khLpd5s3kNKhn/XERFt725eiMVpAI+Hv4tPgR In7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=shs+FjapnOUbxVmRsu3uxl061t4gUOR5wDAB4k/rMUs=; fh=dlnVw+438bMvReSnDTIjCPf3QKtdM2ioS9TzKacx4Ks=; b=N4iUS6qTeC+LzgJ0S467HONyCDjcfhQnFjku9ObWTizLFsfOKAZSApsM3z+/P/Qi0F 6mx16OBJzvfEqMS9LJloWz7ETrH75Zl3VlX/Aqv0Gcj9F+YPWDQZqGdsy97z4QftDlLn ir3X7sOaACrVyycu+gT5KdcGEVplTaKjGO2JYlU2yP2ZXUTj8gWG97wHmDaWNX3jQOHU TUnSzrBzz480sdRPp1o+EH+b2eldX+5lD2u0TRJRmXJ9LwrPs4enEZrDp5W6EGSmZi0f jh6qARDYGTlyIKVCRUpWDSklb2Q9hJ/41wH5KZX7ymGPL1bXI0jMUdwH7o0g8RXS7RW2 I6lg==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771865772; x=1772470572; 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=shs+FjapnOUbxVmRsu3uxl061t4gUOR5wDAB4k/rMUs=; b=dpRgKOPyjbASghu16IfEa0rwl6TH1Ez2NNlnYUDO3/mEtFukW5x90s///gflu2L549 3EpDTFFC1Yp+l1HUV3kra9Nb0eKq4uXys3X+b0lK04LxcPHUIAZKvcumUyVVB8SCJ4M8 VRESsJDD5tURHzvlW7hPL8gTbryHfKuMubLpG3Jh+7RfXDjNDQ6f1l9DDFgfkBWXmXJU ukKYShUhVOeVCZugkaE0ByNVP3EuH8B4aDN1A9yP4yJ28wZfPpmcNqlhwNfhDMBdBdbH V6sfeaPsKqxiSogJUrwmBwFPO9RT4/AqJB+fkBeknukAQsEOwpio3exjxLlNR3AFzmA5 anEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771865772; x=1772470572; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=shs+FjapnOUbxVmRsu3uxl061t4gUOR5wDAB4k/rMUs=; b=VDBK/PlI94x1BuAg/CmWvPz5wDV120lAWn9oqckwL8r+1bq50xkPlT6OuTQQjrRogu X2pQ+qUVTFSAU/mh9oR/rFLN0+ZbTPVN4S4iCqMnpKZGEMYKShJcPqd7uhxSuMKMhL86 Ck1sTqHT8bQ/PgMrtOX831fmSvr8IG2+VW5k1BnYGmQf7WheSAJYEFqAPnQbCaG43QSw X5cKuEAF8cYqSfNXF3BmxvypQQQs97MZ1nq9F/BgwnPBhUkHd7IiL4Ow3MLXDsJee4Wj 8O2U1sxKR4/cHRwqvNih/VwNrhsiuLktPFCEu22v6SX3MMgKPjoV4MWjYzM6x4H9z5bS A4gA== X-Forwarded-Encrypted: i=1; AJvYcCWPywhGJG8aYE4EEgIIN7cvJdJahiTsw99azsjvDpdoSKDl6nop17T39LpP0wsweAtCVjhVPelbXWM=@lists.php.net X-Gm-Message-State: AOJu0YxeDCpa0zk12c6jt3nbI9MJUl/r94kefOj/VX5esO+ZvtpTW0Ry 1fs5Hw+Y0vcvGjvL/u0riQ4otc6tICI1Nl6kkvJSyT6IVWcCe0HUr1SnbxT/RaIdrVc/Lepcq7U /j1WGYK4M77qeu2Tiss/RiNy6/C1nv05qSA== X-Gm-Gg: AZuq6aKKPiViPlRaNRjXcjPZyryDIcmlLtRUJSVh3Nmcri0UUkNYII/aIhG2awjG6Vb /B3tCqh3kQTii2n+CW0j4QR1Pc1HYEIjV0YRuK6k00iASMyNUjO9EgV9t3vDLkKZRgIYE7UbmtO 4MA2ryMG2k6ffHjt+o4R4S52QeATDZ+INB97VmI/2tWmW8btSVFWxy5Ayig5n/5/c8Ob27uTXxV 5ytDTOehDs+dIQ9uuQvXaD9IGdsWJ3wNgdwTinY4oJGTJba17k13CmE4AW9M3oQC8v/gtcYHIZw DpY13M9qA67SgrX9Tv2iNDDpliHwSRj2ie0PLR+Oa1shSsoUWdJBFowFdoylTe/IyblZ/Q== X-Received: by 2002:a4a:e902:0:b0:679:a6a2:55b0 with SMTP id 006d021491bc7-679c4616cecmr4825436eaf.70.1771865771931; Mon, 23 Feb 2026 08:56:11 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <1f25d77e-224b-40d6-bf19-18dfdfc9de54@rwec.co.uk> <453bc043-b4ee-423e-9561-55510f5c20a7@rwec.co.uk> <6412E222-9B0F-4139-A6F9-7D0C686197BF@rwec.co.uk> In-Reply-To: Date: Mon, 23 Feb 2026 23:56:00 +0700 X-Gm-Features: AaiRm50n5aBks-eJZzNabXw0sY7VD3jiKyFCJk26QSSLrbQhsQO5Sq_MyTW_kzY Message-ID: Subject: Re: [PHP-DEV] [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value. To: Mirco Babin Cc: "Rowan Tommins [IMSoP]" , PHP internals Content-Type: multipart/alternative; boundary="000000000000ecfbdc064b80a568" From: pierre.php@gmail.com (Pierre Joye) --000000000000ecfbdc064b80a568 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable hi Mirco, On Mon, Feb 23, 2026, 11:00=E2=80=AFPM Mirco Babin = wrote: > Hello Pierre, > > Op vr 20 feb 2026 om 19:29 schreef Pierre Joye : > > > > Hello Mirco, > > > > > In a context of __construct, disallow any return value can be detected > > as well. Any return statement with anything used with it can be > > rejected (and should). > > > > It is documented as void, we could "fix" it with a bug fix. > > - https://www.php.net/manual/en/language.oop5.decon.php#object.construct > lists the __construct() function as void. > - But the implementation of __construct() is mixed. > > l > see https://www.php.net/manual/en/language.oop5.decon.php __construct(mixed ...$values =3D ""): void > I have found https://php-legacy-docs.zend.com/manual/php4/en/migration5. > But I didn't find any specific __construct() instructions, other than > https://php-legacy-docs.zend.com/manual/php4/en/language.oop5.decon. At > that page, it is not mentioned the __construct() must not return a value. > it should I think, maybe it was not done for bc or avoid breaking codes, but it was years ago. > Could you explain on serialization or hydration challenges in more > details? Perhaps with a theoretical example? > An (old) real-world example would be even better, if you can find one. > Sorry, i do not have the time to look. Try to google a bit, quite a lot of old bugs in various projects about that. Best, > --000000000000ecfbdc064b80a568 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
hi Mirco,




On Mon, Feb 23, 2026, 11:00=E2=80=AFPM Mirco Babin <mirco.babin@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Hello Pierre,

Op vr 20 feb 2026 om 19:29 schreef Pierre Joye <pierre.php@gmail.com>:
>
> Hello Mirco,
>

> In a context of __construct, disallow any return value can be detected=
> as well. Any return statement with anything used with it can be
> rejected (and should).
>
> It is documented as void, we could "fix" it with a bug fix.<= br>
-
https://www.php.n= et/manual/en/language.oop5.decon.php#object.construct
=C2=A0 lists the __construct() function as void.
- But the implementation of __construct() is mixed.

l




__construct(mixed=C2=A0...$values=C2=A0=3D &= quot;"):=C2=A0void


I have found https://php-legacy= -docs.zend.com/manual/php4/en/migration5.
But I didn't find any specific __construct() instructions, other than https://php-legacy-doc= s.zend.com/manual/php4/en/language.oop5.decon. At
that page, it is not mentioned the __construct() must not return a value.

it= should I think, maybe it was not done for bc or avoid breaking codes, but = it was years ago.


Could you explain on serialization or hydration challenges in more
details? Perhaps with a theoretical example?
An (old) real-world example would be even better, if you can find one.
<= /blockquote>

Sorry= , i do not have the time to look. Try to google a bit, quite a lot of old b= ugs in various projects about that.

Best,=C2=A0
--000000000000ecfbdc064b80a568--