#49516 [Opn->Bgs]: Serializing a closure throws an exception

From: Date: Thu, 10 Sep 2009 13:26:42 +0000
Subject: #49516 [Opn->Bgs]: Serializing a closure throws an exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142227@lists.php.net to get a copy of this message
ID: 49516 Updated by: jani@php.net Reported By: oorza2k5 at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: irrelevant PHP Version: 5.3.0 New Comment: Closures are special. And since they're so special, they throw exceptions. Not a bug. Previous Comments: ------------------------------------------------------------------------ [2009-09-10 06:15:08] oorza2k5 at gmail dot com Description: ------------ As far as I'm aware, exceptions are not supposed to be thrown by default, but rather errors are supposed to be raised. Serializing a closure throws an exception, when it should be raising an E_ERROR instead. Reproduce code: --------------- <?php $foo = function() { }; serialize($foo); Expected result: ---------------- E_ERROR is raised and the script dies. Actual result: -------------- An exception is thrown. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49516&edit=1

« previous php.bugs (#142227) next »