Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122104 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38834 invoked from network); 3 Jan 2024 19:21:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2024 19:21:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1704309738; bh=kgWr0YK0867pjhVBBuFKpU8bKyaKyCWKQcABkHSlsjU=; h=In-Reply-To:References:Date:From:To:Subject:From; b=CSJgvBWyCXEmcT1F1o+kreYk9gfQc0BsFp1V9YY9TOBtq5YRguO5kXZbHVqJMqn+A hoMXiQdTrL1DlmMBe5xh9w7GS068w1RQ81YIdO/6x5zmgDlPJZWczVxMpE8ja2Nksj TM48dvnmf54Smlx3rl5jUUIG3NXy5NqW1d8rrxEtrO2uLdDSS2qIPqFEdE5EYXAutE tDn205uncS7nnQuvwFfVmtb1XMCaJ4iwQ5cCZGAz6OIYju1Mi6Wa3ASfuA1i4xIaN+ IClR9knaVDzm8xYmUlXF26vJ0uy2GxNlBFgmNtizn0LfY2xcAOpoU98aOU+i9V4l1a 8H03SoyghotyQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1969C180058 for ; Wed, 3 Jan 2024 11:22:17 -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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (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, 3 Jan 2024 11:22:16 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 903BB3200A83 for ; Wed, 3 Jan 2024 14:21:43 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Wed, 03 Jan 2024 14:21:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1704309703; x= 1704396103; bh=ddPc8l2S126USt+ssLtKW+rxCOhHOq2vEsiXa66vOgI=; b=Q 8/1evOspX2SRrGq+42UcARG235ki310a6Wt5Iz8YvfhZCOYa+JhHmm9KQ9W4TESR wiRWO3LvewAVUasYOOAMtG7vab9P6IR3z8mKVjpjQdKtdO7Ni+DU6FcBiaBlb8na jcE5kLhZ+8kaLt+7VNK8CFmY0Hclof27KR5qPSg7ttxybak/xVo8oQ6mXPVYfYG/ XwG0ptBNENvk6LphD6o+Cx3+r6O+0nzIZY2fomV3Ph8Jt8ae/rYvHsl3H0Jz3xvJ jTqNYyk/xARCCzdeNaJmBZ6pXB9mropr/UM3GXnTBVnqJ7ZhbiW7fIkm167BwKcZ WvhkvtZoA6Y/hGbAEHCrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704309703; x=1704396103; bh=ddPc8l2S126USt+ssLtKW+rxCOhH Oq2vEsiXa66vOgI=; b=7jxM86wLsIwtH6We1pPptoalOvVhb+uhIpN8+a3gYa0k Ib5YRB8YErMKkk4U01obYX9e1SozGHs/rmSFXdwGHAX13ZqR9xFAPvVs56QKvUeW Wcfh/D2yKSUwBfKyZcyvvPy3cfMMrbjYSkUIT8VOPnJVoVdzV4vy+AjMj7of4YcT zcrtLk/PZHQkQfT/kEtzx9FZMq6LvwCCmcyzbNdmh9ZMTVzMniS6ZIMQPCJj5Y5X iv4u21A8hRz9FiTUdmNKydfmHBp9SPb+igDf5lKwv8LZBuZNaTMouwC3SQ6oF9DW MxGTjg/tEfvX38FkuEVmI8L92cqDZFaYeVyGATjiLA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeghedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepfeetveffteetueeukeegjeffudeuhedthfevfeeh iefhheegheffhedthefgleejnecuffhomhgrihhnpehphhhprdhnvghtpdhgihhthhhusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8F4641700093; Wed, 3 Jan 2024 14:21:42 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 MIME-Version: 1.0 Message-ID: <2d65c5b9-0fb6-41eb-a928-69d742b2ec82@app.fastmail.com> In-Reply-To: References: Date: Wed, 03 Jan 2024 19:21:22 +0000 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC][Discussion] NotSerializable attribute From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jan 3, 2024, at 7:11 AM, Nicolas Grekas wrote: > Hi Max, > > Hi, I'd like to propose a new attribute, #[NotSerializable]. This >> functionality is already available for internal classes - userspace should >> benefit from it, too. >> >> The RFC: https://wiki.php.net/rfc/not_serializable >> Proposed implementation: https://github.com/php/php-src/pull/12788 >> >> Please let me know what you think. >> > > 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. > > To me, if this is really the behavior we want, then the attribute should be > replaced by a maker interface. > Then, a simple "instanceof NotSerializable" would be enough instead of > adding yet another method to ReflectionClass. > > Cheers, > Nicolas I think I'm inclined to agree with Nicolas. If the intent here is to impact mainly serialize()/unserialize(), then a marker interface seems like it has the desired logic "built in" more than an attribute does. It would only work at the object level, but that seems correct in this case. For excluding individual properties, __serialize()/__unserialize() already support that use case. That's one of the main uses for them. User-space serializers (Crell/Serde, JMS, Symfony, etc.) could easily be modified to honor the interface as well for external serialization. --Larry Garfield