Bug #76194 [NEW]: built-in function include_once bug with opcache ext open
From: 415401620 at qq dot com
Operating system: Ubuntu 16.04 LTS
PHP version: 7.1.16
Package: opcache
Bug Type: Bug
Bug description:built-in function include_once bug with opcache ext open
Description:
------------
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/eastsea.app/test.php
) 123Array ( [0] =>
/home/vaxilicaihouxian/codes/php/ect/eastsea.app/test.php [1] =>
/tmp/abc.php )
- access the test.php with browser again,the output will be:
123
- 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/eastsea.app/test.php
[1] => /tmp/abc.php ) Array ( [0] =>
/home/vaxilicaihouxian/codes/php/ect/eastsea.app/test.php [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:
---------------
<?php
if(!@include_once('/tmp/abc.php')){
print_r(get_included_files());
swritefile('/tmp/abc.php','<?php echo 123;');
include('/tmp/abc.php');
print_r(get_included_files());
}
function swritefile($filename, $writetext, $openmod='w')
{
if (@$fp = fopen($filename, $openmod)) {
flock($fp, 2);
fwrite($fp, $writetext);
fclose($fp);
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.
--
Edit bug report at https://bugs.php.net/bug.php?id=76194&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76194&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76194&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76194&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76194&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76194&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76194&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76194&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76194&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76194&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76194&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76194&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76194&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76194&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76194&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76194&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76194&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76194&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76194&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76194&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76194&r=mysqlcfg
Thread (3 messages)
- 415401620 at qq dot com