|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-05-09 14:14 UTC] gcp at sjeng dot org
Description:
------------
In some circumstances, global variables will fail to be initialized when auto_globals_jit is enabled (the default). This is a regression, the problem did not exist in 5.1.2.
php.ini is default recommended one. Server is lighttpd 1.4.11 using PHP in FastCGI mode.
Reproduce code:
---------------
Using for example, phpMyAdmin 2.8.0.3, and looking in the
libaries/Config.class.php code:
function checkPmaAbsoluteUri()
{
// Setup a default value to let the people and lazy syadmins work anyway,
// they'll get an error if the autodetect code doesn't work
$pma_absolute_uri = $this->get('PmaAbsoluteUri');
if ( strlen($pma_absolute_uri) < 1 ) {
$url = array();
// At first we try to parse REQUEST_URI, it might contain full URI
if ( ! empty($_SERVER['REQUEST_URI'] ) ) {
$url = parse_url($_SERVER['REQUEST_URI']);
}
// If we don't have scheme, we didn't have full URL so we need to
// dig deeper
if ( empty( $url['scheme'] ) ) {
// Scheme
if ( ! empty( $_SERVER['HTTP_SCHEME'] ) ) {
$url['scheme'] = $_SERVER['HTTP_SCHEME'];
} else {
$url['scheme'] =
!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off'
? 'https'
: 'http';
}
etc...
It's possible to enter this function with $_SERVER missing essential things such as HTTP_HOST:
array(4) {
["PHP_SELF"]=>
string(21) "/mysqladmin/index.php"
["PHP_AUTH_USER"]=> (censored)
["PHP_AUTH_PW"]=> (censored)
["REQUEST_TIME"]=>
int(1147178223)
}
If auto_global_jit is disabled, this does not not happen, and HTTP_HOST etc are set correctly.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 25 20:00:01 2025 UTC |
PHP 5.1.6 (RedHat FC6; std PHP, Apache; fully updated) `auto_globals_jit = On' works fine with 'normal' PHP scripts. However, when included via `auto_prepend_file' $_SERVER is completely absent (together with other Globals). Test case: file script: <?php if( !empty( $GLOBALS[ '_SERVER' ])) { $_SERVER_ARRAY = '_SERVER'; } elseif( !empty( $GLOBALS[ 'HTTP_SERVER_VARS' ])) { $_SERVER_ARRAY = 'HTTP_SERVER_VARS'; } else { $_SERVER_ARRAY = 'GLOBALS'; } global ${$_SERVER_ARRAY}; $ipRemote = ${$_SERVER_ARRAY}[ 'REMOTE_ADDR' ]; var_dump($GLOBALS); ?> httpd.conf: <IfModule mod_php5.c> AddType application/x-httpd-php .html php_value auto_prepend_file "/path/to/test/file" </IfModule> php.ini: variables_order = "EGPCS" register_globals = Off register_long_arrays = Off register_argc_argv = On auto_globals_jit = On The above produces nothing ($_SERVER is absent). Change `auto_globals_jit' to `Off' (plus `apachectl graceful') and it works. Time to pay attention to this, folks. - Alex Kemp