Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113735 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76191 invoked from network); 24 Mar 2021 09:42:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Mar 2021 09:42:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0E27E1804D8 for ; Wed, 24 Mar 2021 02:38:00 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from smtp-in.fusiondirectory.org (smtp-in.fusiondirectory.org [195.154.20.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 24 Mar 2021 02:37:59 -0700 (PDT) Received: from smtp-in.fusiondirectory.org (localhost.localdomain [127.0.0.1]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id B6A581013DA for ; Wed, 24 Mar 2021 10:37:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= fusiondirectory.org; h=cc:content-transfer-encoding:content-type :content-type:date:from:from:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fusiondirectory; bh=oq4xRCjr3+K6c/d7SwBAV31psF5qVfeyBL5mK3ygLm0=; b=c4lBj24JqseW 0bXrS+UtOTIlGB3ANinqWkFOP32B36ZAmeY5+/R4R0OYxNlx5kdzqK54s7lJmXUU Tnynsq9HR4uckWTnrl0lqz0TdqhpVt5TElr8lxDsDQEarndjvLGMYrIYGL8imPAk Io3+IPGBsgh/jtMWmg/6s40O82jtk8yAT5Nm5f7GntgasBUaEaPYfn1oEOeNeK8g /CCewmSlHsguGeLPuYIFK7qHfnYIKog5nbekq1cE7fDxXPLEriwtqKohGr9WPMTS AwF/ovc6UXbBcbkwE40NFz5501/FA0rWSr/Il5CnPYuOZuOi71OHWpkHtgGE0NbU 7U01mXqrew== Received: from smtp.fusiondirectory.org (imap.fusiondirectory.org [195.154.20.141]) by smtp-in.fusiondirectory.org (Proxmox) with ESMTP id 8C03810105A for ; Wed, 24 Mar 2021 10:37:56 +0100 (CET) Received: from mcmic-probook.opensides.be (63.120.199.77.rev.sfr.net [77.199.120.63]) by smtp.fusiondirectory.org (Postfix) with ESMTPSA id 53DC425C715 for ; Wed, 24 Mar 2021 10:37:56 +0100 (CET) Date: Wed, 24 Mar 2021 10:37:54 +0100 To: internals@lists.php.net Message-ID: <20210324103754.2551c075@mcmic-probook.opensides.be> In-Reply-To: References: Organization: FusionDirectory X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Phasing out Serializable From: come.chilliet@fusiondirectory.org (=?UTF-8?B?Q8O0bWU=?= Chilliet) Le Tue, 23 Mar 2021 17:01:40 +0100, Nicolas Grekas a =C3=A9crit : > Picking up a loose thread: > > https://wiki.php.net/rfc/custom_object_serialization introduced a > > replacement for Serializable in PHP 7.4, so it's time to think about > > deprecating and removing the old mechanism: > > > > https://wiki.php.net/rfc/phase_out_serializable > > > > This RFC follows a rather conversative approach. In PHP 8.1 there will = be a > > deprecation warning if Serializable is implemented without also > > implementing __serialize() and __unserialize(). In PHP 9.0, support for > > Serializable is dropped internally, and only the interface retained. In= PHP > > 10.0 the interface is dropped as well. > > =20 It is not clear neither in https://wiki.php.net/rfc/custom_object_serializa= tion nor in the documentation if it is possible to call parent::__serialize() to only add a few fields to serialization. Is this legal/correct/useful: public __serialize ( ) : array { $data =3D parent::__serialize(); $data['specialField'] =3D $data['special']->complicatedStuff(); unset($data['special']); return $data; } public __unserialize ( array $data ) : void { $data['special'] =3D new SpecialComplicatedThing($data['specialField']); unset($data['specialField']); parent::__unserialize($data); } (And as I understand it, it means declaring __unserialize to do something a= fter parent::__unserialize() would be the same as declaring __wakeup?)