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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
16 - 12 = ?
Subscribe to this entry?

 
 [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 15:01:30 2024 UTC