|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-14 12:21 UTC] laruence@php.net
[2016-04-14 12:21 UTC] laruence@php.net
-Status: Open
+Status: Closed
[2016-07-20 11:32 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
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