php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-06-14 21:20 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
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?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-15 02:21 UTC] requinix@php.net
-Status: Open +Status: Suspended
 [2019-06-15 02:21 UTC] requinix@php.net
This matter would probably be better suited for the internals list.
 [2019-09-10 09:17 UTC] dmitry@php.net
Please provide a simple test case with expected and actual behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC