|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78169 preloading + require vs fatal error
Submitted: 2019-06-14 21:20 UTC Modified: 2019-09-10 09:17 UTC
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Suspended Package: opcache
PHP Version: 7.4.0alpha1 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: nicolas dot grekas+php at gmail dot com
New email:
PHP Version: OS:


 [2019-06-14 21:20 UTC] nicolas dot grekas+php at gmail dot com
When opcache.preload is used, requiring twice a file that declares a preloaded class will not yield any error, while when preloading is not used, one will get a cannot redeclare error.

On the other side, when require_once is used, a preloaded class file is not considered "already loaded", which means the require happens during execution.

Would it make sense to change both these behaviors to make them more in line with normal engine behavior?

i.e. "require_once" on a file that was already preloaded wouldn't require it again,
and "require" on a preloaded file that contains a class declaration would yield a "cannot redeclare" fatal error?

This would be more expected to me. WDYT?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-15 02:21 UTC]
-Status: Open +Status: Suspended
 [2019-06-15 02:21 UTC]
This matter would probably be better suited for the internals list.
 [2019-09-10 09:17 UTC]
Please provide a simple test case with expected and actual behavior.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 04 09:03:49 2023 UTC