Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104456 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66290 invoked from network); 18 Feb 2019 18:27:53 -0000 Received: from unknown (HELO mail-ot1-f53.google.com) (209.85.210.53) by pb1.pair.com with SMTP; 18 Feb 2019 18:27:53 -0000 Received: by mail-ot1-f53.google.com with SMTP id 98so28875374oty.1 for ; Mon, 18 Feb 2019 07:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zKxoha1fncFjkWsB8cadGWGRCBMZtujs2zKAsycJ8zY=; b=i6GIYriSLJvykx63zD80u8F8n6O/1VIJsP/ZB0VvneNbwyHrh3T9TDjW1Iu4gFyay4 +gDiTcygDwCHB0i+QNWpwGo9MmYinrUqGRflc4Yzail5qiKxLVHGq9NFIYMl1lxDZxAh am73OC3UY7jIy7iMti78Mfo8/q8Rs09ypDG0r1uEhUoXD1d+JVO7I4WxUS89WdY9SfbU 3iyprXlkrhNrjTqvVvnn+HTM43yT2aRkFIOcMUJTJa3VBvVWuQF2HSwqCnLOFf+K088D To5Ldo6xD1DaOSjWVXCtkeYuJTu6c6bVcooxGe9ygnfEX+l3CcItpQt7Lp9WxY3xCFnh 0gwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zKxoha1fncFjkWsB8cadGWGRCBMZtujs2zKAsycJ8zY=; b=ogfl37RgsCHEgv313jPl7Y7/U9fTngGq+Asx9JGelP9GElO2VhrkuZwi4rqzn7uMRt Db3dIkLZeYhr2HvHe55qGlR2uoSVlkYVvWGpI5dtnZA7lXHeZLGtc6gjgNQbx2VuCLwL 9SaZc2fc3F8pwqqPZ31JOA+0fsdqAKm7jQudEOi0/CZVfpwMHB4ZA+pEK9sRKZHut07D 5K4WQEGji0yPtgiWoQv0vxvG31Bwe5p5s4xgVac0XltnPg4EsUKdkpzi85cB95x/9iXn m/7cLGzMNKytvwlB6X/7wVaZ6clnx3y3wg//RjmesDs0BtVDq/hBGV8WK7jKcERFCBpf cScw== X-Gm-Message-State: AHQUAuaDwXDUkAFQe8kTIFugLXq90igX0WrtG3jIpMB/6NaFzFOV3xkX 4AAv/XZzYDOKo2hlRaByX2RXEAb3RYInqGEutV0= X-Google-Smtp-Source: AHgI3Ib+865ss1UtzomClhfnwkZgserSGVsZ1NVusN1QSEePqwxArEKSyG6IC9ALnWo6+ZPSgXW0qIvalOR7PQhskWY= X-Received: by 2002:a9d:630f:: with SMTP id q15mr14234458otk.187.1550502737358; Mon, 18 Feb 2019 07:12:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 18 Feb 2019 16:12:04 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000e2347305822c8c23" Subject: Re: [RFC] New custom object serialization mechanism From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000e2347305822c8c23 Content-Type: text/plain; charset="UTF-8" Hi Nikita, I'd like to propose a new custom object serialization mechanism intended to > replace the broken Serializable interface: > > https://wiki.php.net/rfc/custom_object_serialization > > This was already previously discussed in > https://externals.io/message/98834, this just brings it into RFC form. > The latest motivation for this is https://bugs.php.net/bug.php?id=77302, > a compatibility issue in 7.3 affecting Symfony, caused by Serializable. We > can't fix Serializable, but we can at least make sure that a working > alternative exists. > Is there anything we can to do to help the RFC move forward? I'm spending a great deal of time removing Serializable from the Symfony code base. It's not pretty nor fun... but we have no choice since as ppl move to PHP 7.3, they can now spot when the current mechanism is breaking their serialized payloads (typically from user objects put in the session storage). About interface vs magic methods, technicaly, we can work with an interface provided by PHP core, so that if that's a blocker for voters to approve the RFC, let's do it - the current situation is really aweful :). FYI, I found myself implementing some getState()/setState() methods of my own, decoupled from the underlying mechanisms used by PHP. That allows me to still use Serializable for BC reasons when needed, or move to __sleep when possible, then move to the new 7.4 style when ready, without requiring any changes from the consumer POV. That's a good illustration of what I meant in my previous email: domain-specific interfaces in everyone's code is a better design as it allows better decoupling. It's also a better design to express that "instances of this interface of mine MUST be serializable". IMHO. Nicolas --000000000000e2347305822c8c23--