php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: own3mall at gmail dot com
New email:
PHP Version: OS:

 

 [2015-01-21 03:49 UTC] own3mall at gmail dot com
Description:
------------
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:

https://www.youtube.com/watch?v=xVLMdgnXfww&feature=youtu.be

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

http://dinofly.com/files/linux/bugs/php5.5.x_refresh_bug.tar.gz

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:
---------------
http://dinofly.com/files/linux/bugs/php5.5.x_refresh_bug.tar.gz

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.  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-21 04:20 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2015-01-21 04:20 UTC] requinix@php.net
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:

http://pastebin.com/xWLweR55

My php.ini:

http://pastebin.com/6ghRdN6P
 [2015-01-21 05:09 UTC] rasmus@php.net
Try uncommenting these entries and setting them like this:

  opcache.validate_timestamps=1
  opcache.revalidate_freq=0

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] rasmus@php.net
-Status: Open +Status: Not a bug
 [2015-01-21 08:22 UTC] rasmus@php.net
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:

;opcache.enable=0

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

opcache.enable=0

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:

  opcache.validate_timestamps=1
  opcache.revalidate_freq=0

Is this a bug then?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 05:01:32 2024 UTC