Bug #70040 [Csd->Nab]: Losing globals and super-globals randomly when using frames.

From: Date: Thu, 16 Jul 2015 16:37:54 +0000
Subject: Bug #70040 [Csd->Nab]: Losing globals and super-globals randomly when using frames.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194497@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70040&edit=1

 ID:                 70040
 Updated by:         cmb@php.net
 Reported by:        phpqa at mathieuviau dot com
 Summary:            Losing globals and super-globals randomly when using
                     frames.
-Status:             Closed
+Status:             Not a bug
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Ubuntu 14.04.2 LTS
 PHP Version:        7.0.0alpha2
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2015-07-16 16:33:05] phpqa at mathieuviau dot com

Turns out it's a wrong server config (not actually using mpm-prefork).

------------------------------------------------------------------------
[2015-07-13 21:59:13] kalle@php.net

Just curious, does this also happen in threaded versions of PHP?

------------------------------------------------------------------------
[2015-07-13 18:19:20] phpqa at mathieuviau dot com

I just did reproduce this on a brand new vagrant box, when there are enough concurrent requests to
the apache server.

Simply spawn multiple processes issuing a bunch of requests to the same script URL, and some of them
will consistently loose the globals.

I used 12 parallel processes, each of them issuing 5k requests in a row, and each of the process
will get the issue at least once.

Btw, it still occurs with beta1.

------------------------------------------------------------------------
[2015-07-13 07:17:27] laruence@php.net

if you don't have a way to reproduce it, then we can not do much things on this..

please, try to figure out a way of how to reproduce it , thanks very much.

------------------------------------------------------------------------
[2015-07-10 13:24:44] phpqa at mathieuviau dot com

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 this bug report at https://bugs.php.net/bug.php?id=70040&edit=1


Thread (7 messages)

« previous php.bugs (#194497) next »