Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121973 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52696 invoked from network); 9 Dec 2023 16:18:04 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Dec 2023 16:18:04 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 82C29180003 for ; Sat, 9 Dec 2023 08:18: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=-3.1 required=5.0 tests=BAYES_00,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.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 ; Sat, 9 Dec 2023 08:18:17 -0800 (PST) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-54f49c10c37so3602005a12.0 for ; Sat, 09 Dec 2023 08:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702138681; x=1702743481; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=B8PS7JqzSpPxv/PjLpKJHJ0qmEkrhjmo6ruWEakSEZA=; b=ext+rprebm0rClkryGvOnc+WDfDqAWdYXpJes4OdfOFE5QYHJGIkpmZ3hZ6hk90Hxu bN/McD1oHjhVRGj/GjIMu8MYKoM53Mz4sD82NPi5iO0IEcPE9adSSmAaCsZhvmkMcD0n /dC+biJMI52U+vCywVjKLek2yMrRm0DoDYe7JQ50RkrT6KBDuMRPRDx58BmW6/QP4WIO Gwobf3e3yNLNfNGwCUvexG5Oeb5yKv0LhQ504fjXRI9ljr1IG3aHXLYRFBJcUIEcaJuy cIfx6DqpNaw1OcK1Xax2VwFthv9SQrJlWuHbHgdVDhR5BTBTZ3QW9+YlSY5i7V/mcVIc SSgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702138681; x=1702743481; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B8PS7JqzSpPxv/PjLpKJHJ0qmEkrhjmo6ruWEakSEZA=; b=hHz/txCQ1P5jrnqZXQk9oTpcrVeaC7hal4bEv+hlwJ7u6nCku3gOJQsdZIQVeOcCEy 21xzsNEsLn6X+TZOne8Ubgf3OaYB83DgJd4IwnGRfKM71L2oERCpqpRHXC+YZwhYBT0k AsqYOloE9e9riWIFZvYxvn3boQ2dq0lCLgcZDe7KJOccgrXZOBoDGZ6Fh8pwux27vV9p GtE4b0e+0CcnZcKH7F969Wrb/Z6WU5lcMAfK+BjtC+ZHr1rtY/1t9A8F8ltSz2yJgs0p agYdlT9+B7EHJ8K/XQn71CAEwWBWXoK1hx5V9nQ5QzGlEn+A9NWFIxVAnJsfh47TSW1E KI8Q== X-Gm-Message-State: AOJu0Yygerw4nBJB5Wc2asjrlI0xqxGaPtS+5wJPoq9EQln3XI3osf2D jM1q0OMpS9vsqN2xzKyDrbYR/ad5iQQ= X-Google-Smtp-Source: AGHT+IGlMZcc391gORCy4b8H4+NdKZFrTrzgFzynXXwnginY5k0g3npYt8nsboSxspw+QV4JzYFFBg== X-Received: by 2002:a05:6402:5c3:b0:548:5671:c86d with SMTP id n3-20020a05640205c300b005485671c86dmr1834743edx.2.1702138680809; Sat, 09 Dec 2023 08:18:00 -0800 (PST) Received: from [192.168.0.59] (178-117-137-225.access.telenet.be. [178.117.137.225]) by smtp.gmail.com with ESMTPSA id o29-20020a509b1d000000b0054ca1d90410sm1890387edi.85.2023.12.09.08.18.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Dec 2023 08:18:00 -0800 (PST) Message-ID: <20add1b7-24ed-42be-ae84-99ef81480fa2@gmail.com> Date: Sat, 9 Dec 2023 17:17:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Discussion] NotSerializable attribute From: dossche.niels@gmail.com (Niels Dossche) Hi Max On 12/9/23 13:30, Max Semenik wrote: > 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. > Thanks for this proposal, it is a sensible addition in my opinion. I do have a question/remark though. The example you wrote in your RFC (with MyClass implementing __sleep and __awake) is not equivalent to adding #[NotSerializable]. This is because if you create a child class of MyClass: ``` class MyClassChild extends MyClass { public function __sleep(): array { return ...; // real implementation instead of throwing } public function __wakeup(): void { ... // real implementation instead of throwing } } ``` Then this subclass MyClassChild will actually be serializable. If you instead put #[NotSerializable] on the parent class MyClass, then the child class won't be serializable even if you implement the serialization methods in the child. Is this intentional? If yes, this should probably be clarified in the text. Kind regards Niels