Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103825 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45486 invoked from network); 24 Jan 2019 16:50:33 -0000 Received: from unknown (HELO mail-it1-f170.google.com) (209.85.166.170) by pb1.pair.com with SMTP; 24 Jan 2019 16:50:33 -0000 Received: by mail-it1-f170.google.com with SMTP id g85so4907896ita.3 for ; Thu, 24 Jan 2019 05:28:41 -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=RUke36mAm3n4X5GYunpwYmRCZhhKS9Ytd8i04HIEmMk=; b=uS5zwp+Phhy71ND4eQvDcxHtj9pFe8HXCnrMaLVXUfsiPsq7wjiO7uyY42U2W8McAf uh5EL2Fp/ZIhM6CV2T8sVWJrg8aoLNnteRIkQEFxYq4LG/xJbCrwPjfPP6IcWdBOWYhl L6qaxy8hF35nL8h68Mza/GXWF0bflQC5nMjUBjXaLGXyIx4l47UGegT4R8oL2o3wGHWn tCB5/rJafyfcNT3ywV8hOGRsn9MywrT+52671TUjvQoMIT9axlwePI81/6qWL5NAJXJf yNubZuAJIBELx6w80GKCe7jXww+0+qOrATfepGG3VzBxXw1GQfSy1A4tJCcY6W3wUieg sm5w== 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=RUke36mAm3n4X5GYunpwYmRCZhhKS9Ytd8i04HIEmMk=; b=r6JPFDMjCAFLNej/UUPfeV26KU5+An6oSsCb3NGVXcI1e2QTSAI4bU6ay/fneqM5T4 J5YExVRFG4bsPVFpAJ/hR1/ku7dE3NlT94W8FMnx07uimjCAKg4xLnGjp9l//msR2q/d qijG9zKcqh3bzORrUv7efFxvKOXY+J995yEY3sM5wWAAh66FCGZbnW8O94nBdkDI4X8k UDR0j4JbhPNbxVMMynovXheWhYeXbq+IK7e1QbEAaMzJlHaXEJEJ0Q+QLTSlZyuaM0Ea WjlT8Jn5ex5dmzzHrNWJ3MfIPMcXDCPNTUThb87HYnE8hUZ/DO6dvs1jrL+sZz1bQEmj M77w== X-Gm-Message-State: AJcUukcdzGw3NsK57lMNbsvsZBbtR3ywaPwNTuz5o/yUsay9b1b4YpxL xVsnVR2QPgVqdZnRZLYHlQBgFh8NuznYk3WEkoq2DoXj X-Google-Smtp-Source: ALg8bN44C3jQmRoS2lFSLZk37OAUbqJO0jg71p1wBylR1X3vlY59PM2Gd8KtpRuqfJPpBQZNGCd58Ds5HgTkPTb1Lxk= X-Received: by 2002:a05:660c:81a:: with SMTP id j26mr1397025itk.70.1548336521386; Thu, 24 Jan 2019 05:28:41 -0800 (PST) MIME-Version: 1.0 References: <20190124131514.CD9051000DB@smtp02.mail.de> In-Reply-To: <20190124131514.CD9051000DB@smtp02.mail.de> Date: Thu, 24 Jan 2019 14:28:24 +0100 Message-ID: To: naitsirch@e.mail.de Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000599f900580343051" Subject: Re: [PHP-DEV] [RFC] New custom object serialization mechanism From: nikita.ppv@gmail.com (Nikita Popov) --000000000000599f900580343051 Content-Type: text/plain; charset="UTF-8" On Thu, Jan 24, 2019 at 2:15 PM wrote: > On Thu, Jan 24, 2019 at 13:27 Nikita Popov > wrote: > > > Hi internals, > > > > 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. > > > > Regards, > > Nikita > > Hi. > > What happens if both `__serialize()` and `__wakeup()` are implemented? > You mean if there are just those two methods, but not __unserialize() for example? In that case the array returned by __serialize() will be unserialized as object properties and __wakeup() will be called for finalization. In principle it's okay to use this combination, though it would be somewhat unusual. We could enforce that if one of __serialize() or __unserialize() is defined, both have to be defined, to avoid running into such cases. At least I don't see much legitimate use for combining __serialize() and __wakeup() or __sleep() and __unserialize(). And another idea for the naming: Maybe one could use `__normalize()` and > `__denormalize()`. Because the methods do not serialize themself, like the > normalizer in the Symfony serializer component. > I'd like that "serialization" appears in some form in the name, to make clear in what context this is used. Normalization is a fairly general term and could refer to any number of things. Nikita --000000000000599f900580343051--