Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:122089
Return-Path: <dusk@woofle.net>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 91932 invoked from network); 3 Jan 2024 08:34:56 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 3 Jan 2024 08:34:56 -0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1704270927; bh=Pb5/To+taITG9zld0J4OaZuxkGMyeb9NrehXhzEts1U=;
	h=Subject:From:In-Reply-To:Date:Cc:References:To:From;
	b=D1qZgKwZJ5zWf8IDI/XdJB2mYQddNf0Uj4wrY5O2QMvrt9sPsYosiv3FPlY/EVO6M
	 Vq59au5aL7SQWsZms1OMUKkii9huTlJntg0N9NgiIDNec7wQD7Gajh6GT1pHoGBJJm
	 qHpVMfwDG9S/NznWIje9ntfAhDgUS4aVXJ9flWp8azVsJzBsR7FZ45yPmcxlAdDQs+
	 WgUmH+Z5ZWArlGOVg8isvApYlc1kehRJW7t39JXUwPRKhlVY9ZjH7LYAd1HYUOrDH4
	 Hil126UGDHaAEBsIZ/w1xjMpzyJrBZIW1cG5euhe8AyONwzoEv0JwCDi/HLXkcxH2G
	 Op2/umUXSLj1Q==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id C8476180066
	for <internals@lists.php.net>; Wed,  3 Jan 2024 00:35:26 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DMARC_MISSING,
	SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <dusk@woofle.net>
Received: from malamute.woofle.net (malamute.woofle.net [74.207.252.100])
	(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 <internals@lists.php.net>; Wed,  3 Jan 2024 00:35:26 -0800 (PST)
Received: by malamute.woofle.net (Postfix) with ESMTPSA id ABC281F13D;
	Wed,  3 Jan 2024 00:34:54 -0800 (PST)
Content-Type: text/plain;
	charset=us-ascii
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\))
In-Reply-To: <CAOWwgpkW65ngNVrtu3oZ3_yAw4W+Qe1DsQ9LN-pfet_Psdy==Q@mail.gmail.com>
Date: Wed, 3 Jan 2024 00:34:43 -0800
Cc: Max Semenik <maxsem.wiki@gmail.com>,
 Internals <internals@lists.php.net>
Content-Transfer-Encoding: quoted-printable
Message-ID: <369B4CA4-3468-43C4-93FA-4944BAFC0973@woofle.net>
References: <CAGgaK7+w_zdp30Pi5nJ-y+GPEkfc2xHfFUW+DwdpNtY8iPjMHg@mail.gmail.com>
 <CAOWwgpkW65ngNVrtu3oZ3_yAw4W+Qe1DsQ9LN-pfet_Psdy==Q@mail.gmail.com>
To: Nicolas Grekas <nicolas.grekas+php@gmail.com>
X-Mailer: Apple Mail (2.3774.300.61.1.2)
Subject: Re: [PHP-DEV] [RFC][Discussion] NotSerializable attribute
From: dusk@woofle.net (Dusk)

On Jan 2, 2024, at 23:11, Nicolas Grekas <nicolas.grekas+php@gmail.com> =
wrote:
> Regarding the inheritance-related behavior ("The non-serializable flag =
is
> inherited by descendants"), this is very unlike any other attributes, =
and
> this actively prevents writing a child class that'd make a parent
> serializable if it wants to.

That seems appropriate. Consider a class which has set itself as =
#[NotSerializable] because it contains something which mustn't be =
serialized (like a secret or an identifier returned by an FFI library), =
or because the lifecycle of objects of that class needs to be tightly =
controlled (like a singleton or a scope guard). It shouldn't be possible =
to make any of these serializable by creating a subclass.=