php.net |  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: love at sickpeople dot se
New email:
PHP Version: OS:

 

 [2016-10-19 19:19 UTC] love at sickpeople dot se
Description:
------------
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))
  {
    return;
  }

class Foo {}


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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 23 09:03:33 2021 UTC