|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76194 built-in function include_once bug with opcache ext open
Submitted: 2018-04-08 03:21 UTC Modified: 2021-07-18 04:22 UTC
From: 415401620 at qq dot com Assigned: cmb (profile)
Status: No Feedback Package: opcache
PHP Version: 7.1.16 OS: Ubuntu 16.04 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: 415401620 at qq dot com
New email:
PHP Version: OS:


 [2018-04-08 03:21 UTC] 415401620 at qq dot com
1. My php.ini file for opcache is the default configuration.
2. Bug description:
When I use include_once to load a config.php file I found that if I delete and recreate the new config.php file.It will not load the current file and include_once return false.But,it don not load the current file correctly either.
I use this test script to show what I mean.

There are test steps:

- create a test.php in your web server root path.
- access the test.php with browser
- see the output for get_included_files,it will be :

Array ( [0] => /home/vaxilicaihouxian/codes/php/ect/ ) 123Array ( [0] => /home/vaxilicaihouxian/codes/php/ect/ [1] => /tmp/abc.php )

- access the test.php with browser again,the output will be:


- remove the /tmp/abc.php with command `rm -f /tmp/abc.php`
- access the test.php with browser finally and the output is:

Array ( [0] => /home/vaxilicaihouxian/codes/php/ect/ [1] => /tmp/abc.php ) Array ( [0] => /home/vaxilicaihouxian/codes/php/ect/ [1] => /tmp/abc.php )

3. Why there is the `/tmp/abc.php` in the finally output array of get_included_files() .It dose not exits but has been included with include_once.
So the second include_once will not work to include my new generating config.php.

Test script:
    swritefile('/tmp/abc.php','<?php echo 123;');

function swritefile($filename, $writetext, $openmod='w')
    if (@$fp = fopen($filename, $openmod)) {

        flock($fp, 2);

        fwrite($fp, $writetext);


        return true;


Expected result:
It should load the new generating file correctly and not ignore by the first include_once function.

Actual result:
The second include_once function ignore the config file.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-08 13:14 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-08 13:14 UTC]
Is this still an issue with any of the actively supported PHP
versions[1]?  Also, are you sure that you don't have file_cache

[1] <>
 [2021-07-18 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: Mon Sep 20 06:03:37 2021 UTC