Bug #70040 [NEW]: Losing globals and super-globals randomly when using frames.
| From: | phpqa at mathieuviau dot com | Date: | Fri, 10 Jul 2015 13:24:46 +0000 |
| Subject: | Bug #70040 [NEW]: Losing globals and super-globals randomly when using frames. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194306@lists.php.net to get a copy of this message | ||
From: phpqa at mathieuviau dot com
Operating system: Ubuntu 14.04.2 LTS
PHP version: 7.0.0alpha2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Losing globals and super-globals randomly when using frames.
Description:
------------
I have this legacy application still using frames with the same init
code for the main page and for each of the frames in the main page.
Randomly, I get one or the other frames (not the main page) to loose
information about some or all of the globals upon reloading the page
multiple times.
I could not reproduce this when using a page without frames.
This is using the php7 module with apache2-mpm-prefork 2.4.7.
It occurs in both Chrome and Firefox (latest versions)
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
[Zend Modules]
Test script:
---------------
Full set of source files available here:
http://www.mathieuviau.com/php-test-globals.tgz
** init.php **
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
if (isset($_SERVER['SCRIPT_NAME'])) {
$a = explode('/', $_SERVER['SCRIPT_NAME']);
} elseif (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) {
$a = explode('/', $HTTP_SERVER_VARS['SCRIPT_NAME']);
} else {
var_dump(array_keys($GLOBALS));
var_dump($_SERVER);
debug_print_backtrace();
$error = 'Unable to detect script environment.';
die($error);
}
Expected result:
----------------
In the frames pages, the $GLOBALS and $_SERVER variables must be always
defined. Output should look like:
Array ( [0] => _GET [1] => _POST [2] => _COOKIE [3] => _FILES [4] =>
GLOBALS [5] => _SERVER [6] => a )
Actual result:
--------------
From time to time I do get either one of those results:
Notice: Undefined variable: GLOBALS in /var/www/.../init.php on line 10
Warning: array_keys() expects parameter 1 to be array, null given in
/var/www/.../init.php on line 10
NULL
Notice: Undefined variable: _SERVER in /var/www/.../init.php on line 11
NULL #0 require() called at [/var/www/.../right_main.php:2] Unable to
detect script environment.
Or the following (less often):
Notice: Undefined variable: GLOBALS in /var/www/.../right_main.php on
line 11
Warning: array_keys() expects parameter 1 to be array, null given in
/var/www/.../right_main.php on line 11
Or even (not very often, but still reproductible):
array(5) { [0]=> string(4) "_GET" [1]=> string(5) "_POST" [2]=>
string(7) "_COOKIE" [3]=> string(6) "_FILES" [4]=> string(7)
"GLOBALS" }
Notice: Undefined variable: _SERVER in /var/www/.../init.php on line 11
NULL #0 require() called at [/var/www/.../right_main.php:2] Unable to
detect script environment.
--
Edit bug report at https://bugs.php.net/bug.php?id=70040&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70040&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70040&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70040&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70040&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70040&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70040&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70040&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70040&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70040&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70040&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70040&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70040&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70040&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70040&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70040&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70040&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70040&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70040&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70040&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70040&r=mysqlcfg