|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73353 Discrepancy with opcache enabled/disabled
Submitted: 2016-10-19 19:19 UTC Modified: 2016-11-05 01:09 UTC
From: love at sickpeople dot se Assigned:
Status: Closed Package: opcache
PHP Version: 7.1.0RC4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 + 41 = ?
Subscribe to this entry?

 [2016-10-19 19:19 UTC] love at sickpeople dot se
With opcache enabled PHP fails with "Cannot declare class Foo, because the name is already in use".

If opcache is disabled, the code is working as expected (no error).

I have no .ini files except one file with "opcache.enable = 1", in conf.d

Test script:
/* File 1 */

  ini_set ('display_errors', true);

  var_dump (opcache_is_script_cached (__FILE__));

  include "foo.php";
  include "foo.php";

/* File "foo.php" */

if (class_exists ('Foo', false))

class Foo {}

Expected result:
The second include of foo.php should return before declaring Foo again.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-05 01:09 UTC] love at sickpeople dot se
-Status: Open +Status: Closed
 [2016-11-05 01:09 UTC] love at sickpeople dot se
This is not a new problem. It is fixed by setting the INI opcache.dups_fix.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Sep 24 07:01:24 2023 UTC