|  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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC