|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78240 Include/require doesn't seem to preload
Submitted: 2019-07-02 13:09 UTC Modified: 2019-07-14 04:22 UTC
Avg. Score:3.5 ± 0.5
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: brent at spatie dot be Assigned:
Status: No Feedback Package: opcache
PHP Version: 7.4.0alpha2 OS: macOS Mojave
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-07-02 13:09 UTC] brent at spatie dot be
The `opcache.preload` documentation ( states:

"[…] either by includeing them or by using the opcache_compile_file() function"

However, using `include`, `include_once`, `require` or `require_once` doesn't seem to actually preload files.

Test script:
The source code:

The preload file:

Tested by dumping `opcache_get_status()['scripts']` right after a server restart:

Using `opcache_compile_file()`, 39 files are available, while only 16 files are available when using `require` or `include` (these are all non-class files)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-05 11:52 UTC]
-Status: Open +Status: Feedback
 [2019-07-05 11:52 UTC]
I can't reproduce this. Using require_once I get 859 preloaded classes. Using require I get a fatal error due to a redeclared class.
 [2019-07-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 18 15:03:37 2021 UTC