|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: love at sickpeople dot se
New email:
PHP Version: OS:


 [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: Mon Sep 25 14:01:25 2023 UTC