Bug #66377 [NEW]: closure instantiation is not allowed when return string class name
| From: | dev at nicolab dot net | Date: | Tue, 31 Dec 2013 21:28:40 +0000 |
| Subject: | Bug #66377 [NEW]: closure instantiation is not allowed when return string class name | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183518@lists.php.net to get a copy of this message | ||
From: dev at nicolab dot net
Operating system: Debian 7
PHP version: 5.4.23
Package: Class/Object related
Bug Type: Bug
Bug description:closure instantiation is not allowed when return string class name
Description:
------------
Hello,
closure instantiation is not allowed when the closure return a string
class name.
My PHP package :
$ php -v
PHP 5.4.4-14+deb7u7 (cli) (built: Dec 12 2013 08:42:07)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
Test script:
---------------
$class = function(){
return '\StdClass';
};
new $class();
Expected result:
----------------
(object) instance of \StdClass
Actual result:
--------------
Catchable fatal error: Instantiation of 'Closure' is not allowed in
/var/www/file.php on line 30
--
Edit bug report at https://bugs.php.net/bug.php?id=66377&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66377&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66377&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66377&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66377&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66377&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66377&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66377&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66377&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66377&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66377&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66377&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66377&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66377&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66377&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66377&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66377&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66377&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66377&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66377&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66377&r=mysqlcfg