Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69296 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10242 invoked from network); 23 Sep 2013 20:13:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2013 20:13:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.47 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.212.47 mail-vb0-f47.google.com Received: from [209.85.212.47] ([209.85.212.47:62643] helo=mail-vb0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/90-07641-101A0425 for ; Mon, 23 Sep 2013 16:13:53 -0400 Received: by mail-vb0-f47.google.com with SMTP id h10so2543165vbh.6 for ; Mon, 23 Sep 2013 13:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kpNf1foBvnVm5/VscOl4A6UUPlN8JsoJwjh6pH0ug5M=; b=P3iwhtkUDKulotP2jcn0OlnPMdqKfh8taWs+nnSdPhHqV0GabuntOkmdv62Kk/5Lhy GKfBWB96BDlu3gRrMWN+j4yTsLjG/Lqf83pvVdgkOJ5T9iXY9Nh6rPsQrIlKpIqDY1W5 ufJ4ZIpx2LePDVq9q++bzYGn7JX1K9yUlw6o66sL+aoMqZLcKlj4NULPusiBGh+V9EQh wh19sNEyIeaNwUr/+ooqSOiYC3KLwHN5ZQU30NC5meLsq89wGIvxYGd6bUYApSV4H/tX JNMMrjmSZ+3kJQu0pjuxog5OPTyX5vw3LBiv+Qgiidnf2Z3n4147RS0IRpyspIsad3vO X0sw== MIME-Version: 1.0 X-Received: by 10.52.111.10 with SMTP id ie10mr220768vdb.56.1379967230734; Mon, 23 Sep 2013 13:13:50 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.52.76.68 with HTTP; Mon, 23 Sep 2013 13:13:50 -0700 (PDT) In-Reply-To: <6D.71.03575.86970425@pb1.pair.com> References: <6D.71.03575.86970425@pb1.pair.com> Date: Mon, 23 Sep 2013 21:13:50 +0100 X-Google-Sender-Auth: RIKCqW0Rsevx-3i4Jf5Q52wHjNQ Message-ID: To: Joe Watkins Cc: PHP internals list Content-Type: multipart/alternative; boundary=bcaec548a40d96f79c04e712a86e Subject: Re: [PHP-DEV] Re: RFC: Anonymous Classes From: bukka@php.net (Jakub Zelenka) --bcaec548a40d96f79c04e712a86e Content-Type: text/plain; charset=ISO-8859-1 Hi, Serialization: > > As I have said, serialization does work, and unserialization does work > ... > > Classes do have unique names, so as long as the entry is present upon > unserialize you will get the object you expect ... if the entry is not > present unserialization will fail silently. > > The same kind of thing can happen where you have declared a class based > on some predicate, whose value has changed upon unserialize and so the > entry is not present ... > > I'm not sure it is necessary to force any particular behaviour for > serialization, it depends entirely on the application whether or not the > entry is present upon serialization, it should be left down to the > programmer. > sorry if I missed something when I read your patch but the name of the class is defined as Class$$%lu where %lu is substituted by the current compiler global variable anon_class_id that is incremented before. This could lead to the unexpected results when the script that unserialize objects define anonymous classes in different order than serializing script. Then you can get completely different definition. In most cases you would get when you try to use some method that are not defined but you could also have something like this: serialize script foo(); // 101 $b->foo(); // -1 unserialize script foo(); // 99 $b->foo(); // 1 I know that this just a non-sense example but there could be some more complex situations that this could happened. You will get different result just because the classes are defined in different order... As I said I could miss something but if this is the case I think that the serialization issue should be addressed in the patch. Jakub --bcaec548a40d96f79c04e712a86e--