|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68869 Require and Include Files with Variables Doesn't Update Global Value on Refresh
Submitted: 2015-01-21 03:49 UTC Modified: 2015-01-22 00:25 UTC
From: own3mall at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.6.4 OS: Ubuntu 14.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: own3mall at gmail dot com
New email:
PHP Version: OS:


 [2015-01-21 03:49 UTC] own3mall at gmail dot com
Basically, if a redirect is sent such as header("Location: page.php"); to the client or the page is refreshed by the client, a variable being loaded through a require statement does not always update in the global scope.  The global variable's value is set to the old value even though the file the variable is loaded from has changed.  The old value remains until the page is refreshed again after a wait period.  

I was able to reproduce this issue on PHP 5.5.9 and PHP 5.6.4.

Here's a video which explains and shows what is going on:

The source to the script shown in the video can be downloaded here:

I was not able to reproduce this issue on a php 5.3.x virtual machine running Ubuntu 12.04.  Basically, I'm not sure when this bug was introduced, but I know it doesn't happen on older versions of php.

Test script:

Expected result:
Global variable value should be updated on each page refresh or load to what is defined in the file that is required.

Actual result:
Global variable sometimes updates correctly when the page is refreshed but other times is not if refreshed quickly.  It needs to be consistent.  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-21 04:20 UTC]
-Status: Open +Status: Feedback
 [2015-01-21 04:20 UTC]
What are your opcache settings?
 [2015-01-21 04:55 UTC] own3mall at gmail dot com
-Status: Feedback +Status: Open
 [2015-01-21 04:55 UTC] own3mall at gmail dot com
Which settings are you specifically interested in?  My /etc/apache2/apache2.conf looks like this:

My php.ini:
 [2015-01-21 05:09 UTC]
Try uncommenting these entries and setting them like this:


and restart apache, of course.
 [2015-01-21 06:38 UTC] own3mall at gmail dot com
OK, well that's strange.  That appears to work...

But I wasn't even using opcache.  It was commented out which I would assume means it was disabled?  I guess not...

Maybe the settings you sent me should be the defaults?
 [2015-01-21 08:22 UTC]
-Status: Open +Status: Not a bug
 [2015-01-21 08:22 UTC]
The default is that opcache is not enabled which means by default you wouldn't have seen this problem. You must have manually enabled it somewhere. grep through your other .ini file. phpinfo() will show you the ini files that were read on startup.
 [2015-01-22 00:25 UTC] own3mall at gmail dot com
opcache is enabled by default.  I checked all of my php related ini files that were loaded as listed by phpinfo();

This was in my php.ini:


If it's commented out, opcache is enabled by default.  If I uncomment the line like this:


It is then disabled.  Clearly, that would suggest that opcache is enabled by default.

If opcache is enabled by default, I would recommend setting the default settings to:


Is this a bug then?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 10:01:33 2024 UTC