Bug #78240 [Opn->Fbk]: Include/require doesn't seem to preload
| From: | nikic@php.net | Date: | Fri, 05 Jul 2019 11:52:11 +0000 |
| Subject: | Bug #78240 [Opn->Fbk]: Include/require doesn't seem to preload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221642@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78240&edit=1
ID: 78240
Updated by: nikic@php.net
Reported by: brent at spatie dot be
Summary: Include/require doesn't seem to preload
-Status: Open
+Status: Feedback
Type: Bug
Package: opcache
Operating System: macOS Mojave
PHP Version: 7.4.0alpha2
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2019-07-02 13:09:36] brent at spatie dot be
Description:
------------
The
opcache.preload documentation
(https://php.net/manual/en/opcache.configuration.php#ini.opcache.preload) 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: https://github.com/brendt/laravel-preload
The preload file: https://github.com/brendt/laravel-preload/blob/master/preload.php#L88
Tested by dumping opcache_get_status()['scripts'] right after a server
restart: https://github.com/brendt/laravel-preload/blob/master/routes/web.php#L16
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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78240&edit=1