Bug #69761 [Asn->Csd]: Serialization of anonymous classes should be prevented
| From: | laruence@php.net | Date: | Sat, 13 Jun 2015 02:54:20 +0000 |
| Subject: | Bug #69761 [Asn->Csd]: Serialization of anonymous classes should be prevented | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193383@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69761&edit=1
ID: 69761
Updated by: laruence@php.net
Reported by: mhujer at gmail dot com
Summary: Serialization of anonymous classes should be
prevented
-Status: Assigned
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Windows 8/Linux
PHP Version: master-Git-2015-06-05 (snap)
Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d96dda8d49711303d14471ac59ba929892bc532a
Log: Fixed Bug #69761 (Serialization of anonymous classes should be prevented)
Previous Comments:
------------------------------------------------------------------------
[2015-06-05 17:19:24] mhujer at gmail dot com
Description:
------------
According to the Anonymous classes RFC (https://wiki.php.net/rfc/anonymous_classes), it should not
be possible to serialize them ("Serialization is not supported, and will error just as
anonymous functions do.").
But it is possible to serialize them in latest snapshot (Windows) or in 3v4l.org http://3v4l.org/tIEp7 - but the unserialization fails.
When I try to serialize Closure, exception with "Serialization of 'Closure' is not
allowed" is thrown.
Test script:
---------------
<?php
$instance = new class('foo') {
public function __construct($i) {
var_dump($i);
}
};
var_dump($instance);
var_dump(serialize($instance));
var_dump(unserialize(serialize($instance)));
$a = function ($a) {};
var_dump($a);
var_dump(serialize($a));
var_dump(unserialize(serialize($a)));
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69761&edit=1