php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37966 $_SERVER will be destroyed when auto_globals_jit is enabled
Submitted: 2006-06-29 21:06 UTC Modified: 2006-06-29 22:01 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sy at go2panel dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 5.1.4 OS: Redhat EL 4.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 47 = ?
Subscribe to this entry?

 
 [2006-06-29 21:06 UTC] sy at go2panel dot com
Description:
------------
auto_globals_jit will not initialize $_SERVER if $_ENV and $_COOKIE is accessed before any access to $_SERVER.

This relates to setting cookie to browser. A few times refresh may be required to reproduce.

These have been reproduced using Mozilla Firefox and MS Internet Explorer, latest versions available when this is posted.

Modules
/php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
date
dba
dbase
dom
exif
ftp
gd
hash
iconv
libxml
mbstring
mysql
openssl
pcntl
pcre
PDO
posix
Reflection
session
SimpleXML
soap
sockets
SPL
SQLite
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib

[Zend Modules]
NONE


Reproduce code:
---------------
<?php
#
# (c) GO2PANEL Corporation
# sy go2panel com
# BUG CASE


// If all lines are commented, $_SERVER array will not be generated (BUG)
// If any line is uncommented, $_SERVER array will be generated (EXPECTED)

//$a = var_export($_SERVER, TRUE);
//if (isset($_SERVER)) TRUE;
//$b = $_SERVER['SERVER_NAME'];

$_COOKIE['say'] = 'hi';
$H = $_ENV['HTTP_HOST'];

var_dump($_SERVER);


?>


Expected result:
----------------
array(49) {
  ["FCGI_ROLE"]=>
  string(9) "RESPONDER"
  ["REDIRECT_SCRIPT_URL"]=>
  string(6) "/b.php"
  ["REDIRECT_SCRIPT_URI"]=>
  string(27) "http://somehost/b.php"
  ["REDIRECT_REMOTE_USER"]=>
  string(0) ""
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["SCRIPT_URL"]=>
  string(6) "/b.php"
  ["SCRIPT_URI"]=>
  string(27) "http://somehost/b.php"
  ["REMOTE_USER"]=>
  string(0) ""
  ["HTTP_HOST"]=>
  string(14) "somehost"
...


Actual result:
--------------
array(2) {
  ["PHP_SELF"]=>
  string(6) "/b.php"
  ["REQUEST_TIME"]=>
  int(1151614513)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-29 21:11 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-06-29 22:01 UTC] sy at go2panel dot com
This bug CANNOT be reproduced PHP Version 5.2.0-dev dated 20060613
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 08:02:42 2024 UTC