Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130136 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 71B371A00BC for ; Mon, 23 Feb 2026 16:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771862424; bh=Og+LGmHwOK0vgqPlMi2qFGUcv5aSNgCVqhguQg4X+io=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Y+iq4bclW6qB0X2OhHhx+HmSmy5+ntFeIBnnFa13OQs/GZg+zjdrPnzeQzsk7RRKx 1/DpwzPspbcv6DcGu2XmfqqcLwNm3Gd122cBu/8CyWgzVgYXeIPCmdCLoiJL8P16US CXYYYmcwpuTYsnn6Nw9WcDR0Q7EMHmHereN1yOCuTMuKYRELJGH4nqpYvqkAR9L+AE i4DhEtLXTV7XeU0uu4SJ2U2bN1dp3/ti5H1C5A4SayD8TWip7UCiBJaZ9kvE0UTJ7S 1Q0LuOkrFsCYT5ZiHRDb78STxXWPJGoYCgOTQRNJ3iuVnFCyURk36Wcz1yKDiAicj9 jpeL8BlJKGx6w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 88372180081 for ; Mon, 23 Feb 2026 16:00:23 +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=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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:00:23 +0000 (UTC) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-40946982a78so1512082fac.2 for ; Mon, 23 Feb 2026 08:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771862418; cv=none; d=google.com; s=arc-20240605; b=hGn+7wAqyGSrfQfAHnBDRK669pR+MSQC1lraRL6fmHuc2Y81g3DBh6Ymdy/27wzYeR CgDMh4wlVzRWX6CN7RPuxGj+Z9tb0Znj7us2Sfib/JzxQQSMQPvUdVfw2kRJdVOHu++z 1JRkZ7Ptv51dg98Rm4jsFGV2bY8aGvZk8Tqt0Wl5KV9HaW08JuReOD102CUF4auZT9I4 w1uVVyBXFE4r/fIFqafs47nyHCf1Md31mK6yCgSzzOSXDnnOi08bendyZU/2w+JAS8mp M3ChdvBZvODdhV2O8VEpl6m7gcFu3G2lcvlelVKE1Z0ysJtaq/QLfvWb/62E41xjflSJ 7lcw== 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=5K7x2Jvt7oAPnIdpgqxGkPONSbijbNZ7dfr5f6hVhG4=; fh=/QXLhfZyWTo+9tRAq+YS+oFXf7ZmcqS5HnztP/gZ/zg=; b=R6N70zjl5Kt19jXA41AaCuAlTN4zugda+HSAQILA4lPuyL8E4bIe8D/14gRotNW3ug cUeG0yEdcMYY+gqrSwhBGziTP9iBK77Tr8GfLCiIjHn4G3G0s3CNi/cEIQ8PfcDu02v8 YacEqU+xUwQXPRiCIpxHfTMozATImbfjzpu+oL37W09qKnQdBcc4a9k2dXmXXeHof+VV Byg64uDLEob7U6nCgAtBG1KMl9lAjVmDpcLM/cdCumHSlTI/ugEK+UvlthddJkrv3hQE DgEYr6U062wrLBjQiHnKDUJG85nsaUDLYz9IZAJll14vXNz8/gMpFx33giaivOtMXG3h v2tw==; 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=1771862418; x=1772467218; 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=5K7x2Jvt7oAPnIdpgqxGkPONSbijbNZ7dfr5f6hVhG4=; b=TnkkVVv/gFWKAsblE/eXN9bz1wKWj1iqqAiF5NnwkeA5K4drpcFIsqB8De7zc953KC cgdYygxgwCHTRoDm5uLVsSRJe8ahq9IDMz453FUprzvcGzi45xLsi62j79njtRN/+VUo ohNJkCeqetkQcm0tQ/m3gT0Kz5XUzE0/OYCQjBglZK9EMixGZu8s5rOkpnMVKsBrDkEd 4FshVr4fNDyzdKa0dqbx6h+5c2bDInX90Rt9/ZRambfMVTUqbN0OHkd+UTyrLJRLX6MA d1Xcqu73MxUNLyHjD8JMYti2mCYU3HZUBHaS1+I+H195MvcaG9JF3KUCSaWToLKpCDjf aGeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771862418; x=1772467218; 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=5K7x2Jvt7oAPnIdpgqxGkPONSbijbNZ7dfr5f6hVhG4=; b=I0bka+v1LhXwN3HsR/bWrtMyr0+sPNiTe/T97LaHhOMMdfvE13UdbviFpDx0y7BhtB Q1u1KJdkgOZVI1Ly9Yc1YtebLPVFqGsIckc+vRbh5JKi08LtfwMrMG1u3igULQXNBm4u +RZriNZYh9D28+giEIp/NnfN7zfieqMvkKrVftDTeJb5sjEaBboiXY7pwx2WaE3r7fsq 5sOVOJJgegIIh9EhTHlnIzXbPh1xlg3k9FQ3rzjA6e5QhZjd+TElwejT3mAbsEDGgRE+ WUkbmtc0PfZusU6J7RKYR3nApDLXzUZEtT4w1u8oc170p5TRKUcjMH/0QeM+o+H/8yta kJQw== X-Forwarded-Encrypted: i=1; AJvYcCVRzJY+3+/+zc4kbIQVdNScqISWhCnp6VotZ+wCFkw5qh4tZv1X5+QiDVRWZlazOl1zDxuPB/wLkDA=@lists.php.net X-Gm-Message-State: AOJu0YyC0wdxsK27LcevkUQM/g1F3X/wMgZJWTsu5s+cwN8/3dCBhlYs 8EOB643bAtlV04nBv69MDGIYBkeVZsIW87LTCmWlwgsPV9uG8lCWlrAY5wbyxM0TIuYnaSo94sk Cpi84WcsJgrLF05/VxYaNTdIFwTpQGBc= X-Gm-Gg: ATEYQzyiMK9D4YQrqe2b6kAieALEx4wkyp9tzjGTJi5wAMfDi64vnzXS6gvJywj2aG6 lBhzPhePxKrK6RX/+43EfPpGPqfsiHD0VyvamfisTlgk3VMtTF22p4n56DxbpzQE62cWdb+hVzp gnTfkRuth6kBCE6mImfZZFAx7iSbiQEhCXmfLupEE5HUvHHGIQW0EL0IkFFzG23MBmTAnr5Haz8 BqbAPW4JvzTLYRpu0CFlrXjrdY6RVyn+xeRoJdoKpMZ7mCtwE+7+vxpU81VXmwSX+NovVDck5EM N92yDiGUXpHoLr3W9XwFk/Fw2/j/PJSmU0Be7C/6KzMTKfU= X-Received: by 2002:a05:6871:314a:b0:404:168:3ba1 with SMTP id 586e51a60fabf-4157ac5a4cfmr5302348fac.18.1771862417565; Mon, 23 Feb 2026 08:00:17 -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 17:00:06 +0100 X-Gm-Features: AaiRm52-hgAtyklRTWWZjGsfZuSzuR3koec4hO5naDBKb850lsMxso7Yd120x2s Message-ID: Subject: Re: [PHP-DEV] [IDEA for RFC] let the "new" operator fail when the __construct() function returns a value. To: Pierre Joye Cc: "Rowan Tommins [IMSoP]" , PHP internals Content-Type: text/plain; charset="UTF-8" From: mirco.babin@gmail.com (Mirco Babin) 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. > > Also, about this whole discussion , that __ construct, can still be > called as a normal method. Some relics of php 4-5 migration path and > then work around serialization or hydration challenges. > > Most maintained projects out there moved away from these hacks and > rely on new reliable solution for these challenges, like doctrine > or symfony serializer. 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. 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. Kind regards, Mirco Babin