Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69299 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25450 invoked from network); 23 Sep 2013 20:27:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2013 20:27:59 -0000 Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:59654] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/73-07641-C24A0425 for ; Mon, 23 Sep 2013 16:27:25 -0400 Received: by mail-wg0-f51.google.com with SMTP id c11so3542914wgh.18 for ; Mon, 23 Sep 2013 13:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=LveLqrn4e4KLCTrWpVnDKBOakVqWVYvgwVNPILd76Z4=; b=pdeVmQd83o9OWdJ2HnA2jfR1ThcYNOh6EEtFNe7+aHvsEiYVkXx/qVEZfQl9xWUw8o Aig7WDjgx0/xRM+sKsebAfRfsgpGUtiUpzLu31O779aKq32Zk4iNFkjKjTr9ZHduF+ms xD7CrqkLo4QAJWkZZ2yxzyrGibI0mqe6LSl2Mq67GfVsJeZLw3wHvfSxaY7kGr+uBJMb 8yFg2GA4FWuTM6+0aKJRjPnHsWU7Lvr9GeyOwrdBBJQuSFoHpK2H1ZIKvku7V0TAmBlx YATdO6FN6Qh+OdBJQdkRbHLNVgohGZP7hNlUOC0efwRVPWkVJgltlt7g5IYOnbFPK9IS /LPQ== X-Received: by 10.194.174.36 with SMTP id bp4mr18525667wjc.7.1379968040815; Mon, 23 Sep 2013 13:27:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.5.9 with HTTP; Mon, 23 Sep 2013 13:26:40 -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 22:26:40 +0200 Message-ID: To: Joe Watkins Cc: PHP internals list Content-Type: multipart/alternative; boundary=089e0141a0aedfd57504e712d806 Subject: Re: [PHP-DEV] Re: RFC: Anonymous Classes From: krebs.seb@gmail.com (Sebastian Krebs) --089e0141a0aedfd57504e712d806 Content-Type: text/plain; charset=ISO-8859-1 2013/9/23 Joe Watkins > On 09/23/2013 07:39 AM, Joe Watkins wrote: > >> Morning All, >> >> https://wiki.php.net/rfc/**anonymous_classes >> >> I'd like to hear thoughts regarding the addition of anonymous >> classes, patch included. >> >> Cheers >> Joe >> > > Serialization: > > As I have said, serialization does work, and unserialization does work > ... > Actually if you cant unserialize a "serialized object", it isn't a serialized object, but only a string describing the object it was created from. > > 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. > Which name do you give them? The name of the originating interface/class? if ($debug) { $listener = new class extends ListenerInterface () { public function onFoo() { debug(); }; }; } else { $listener = new class extends ListenerInterface () { public function onFoo() { normal(); }; }; } $someBar->addListener($listener); $x = serialize($listener); > > 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. > > Cheers > Joe > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch --089e0141a0aedfd57504e712d806--