Bug #72014 [Opn->Csd]: Including a file with anonymous classes multiple times leads to fatal error
| From: | laruence@php.net | Date: | Thu, 14 Apr 2016 12:21:48 +0000 |
| Subject: | Bug #72014 [Opn->Csd]: Including a file with anonymous classes multiple times leads to fatal error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200546@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72014&edit=1
ID: 72014
Updated by: laruence@php.net
Reported by: gabriel dot birke at gmail dot com
Summary: Including a file with anonymous classes multiple
times leads to fatal error
-Status: Open
+Status: Closed
Type: Bug
Package: opcache
Operating System: Linux
PHP Version: 7.0.5
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8a17b1a2415cc3a44b74bb9bab18d6dded1ee9b0
Log: Fixed bug #72014 (Including a file with anonymous classes multiple times leads to fatal error)
Previous Comments:
------------------------------------------------------------------------
[2016-04-13 09:54:43] gabriel dot birke at gmail dot com
Description:
------------
When opcache is enabled, including a file with an anonymous class multiple times causes the error
message "Cannot declare class class@anonymous, because the name is already in use". When
turning off opcache in the php.ini (setting opcache.enabled=0) the error message disappears.
Test script:
---------------
<?php
/** file anon.php */
$a = new class() { public $testvar = "Foo\n"; };
echo $a->testvar;
?>
<?php
/** file inlcude_test.php */
include("anon.php");
include("anon.php");
Expected result:
----------------
Foo
Foo
Actual result:
--------------
Foo
PHP Fatal error: Cannot declare class class@anonymous, because the name is already in use in
/var/www/anon.php on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72014&edit=1