Tom: Bug bei $GLOBALS ?

Beitrag lesen

Hello,

nun hat dieser Thread doch noch etwas mystisches.

Ich habe gerade mal in der php.ini

register_long_arrays = off

gesetzt und dann auch das Script

<?php   ### get_globals.php ###

echo "<pre>\n";
print_r($GLOBALS);
#print_r($_SERVER);
echo "<pre>\n";

?>

die Antwort

Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_POST] => Array
        (
        )

[_GET] => Array
        (
        )

[_COOKIE] => Array
        (
        )

[_FILES] => Array
        (
        )

)

erhalten.

Wenn man nun aber fragt

<?php   ### get_globals.php ###

echo "<pre>\n";
print_r($GLOBALS);
print_r($_SERVER);
echo "<pre>\n";

?>

erhält man

Array
(
    [GLOBALS] => Array
 *RECURSION*
    [_POST] => Array
        (
        )

[_GET] => Array
        (
        )

[_COOKIE] => Array
        (
        )

[_FILES] => Array
        (
        )

[_SERVER] => Array
        (
            [HTTP_ACCEPT] => */*
            [HTTP_REFERER] => http://testserver/~thomas/php4/Arrays/
            [HTTP_ACCEPT_LANGUAGE] => de
            [HTTP_ACCEPT_ENCODING] => gzip, deflate
            [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
            [HTTP_HOST] => testserver
            [HTTP_CONNECTION] => Keep-Alive
            [PATH] => /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch1 mod_perl/2.0.2 Perl/v5.8.8 Server at testserver Port 80

[SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch1 mod_perl/2.0.2 Perl/v5.8.8
            [SERVER_NAME] => testserver
            [SERVER_ADDR] => 192.168.101.99
            [SERVER_PORT] => 80
            [REMOTE_ADDR] => 192.168.101.114
            [DOCUMENT_ROOT] => /var/www/
            [SERVER_ADMIN] => webmaster@localhost
            [SCRIPT_FILENAME] => /home/thomas/web/php4/Arrays/get_globals.php
            [REMOTE_PORT] => 2400
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_PROTOCOL] => HTTP/1.1
            [REQUEST_METHOD] => GET
            [QUERY_STRING] =>
            [REQUEST_URI] => /~thomas/php4/Arrays/get_globals.php
            [SCRIPT_NAME] => /~thomas/php4/Arrays/get_globals.php
            [PHP_SELF] => /~thomas/php4/Arrays/get_globals.php
            [REQUEST_TIME] => 1176825406
            [argv] => Array
                (
                )

[argc] => 0
        )

)
Array
(
    [HTTP_ACCEPT] => */*
    [HTTP_REFERER] => http://testserver/~thomas/php4/Arrays/
    [HTTP_ACCEPT_LANGUAGE] => de
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
    [HTTP_HOST] => testserver
    [HTTP_CONNECTION] => Keep-Alive
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch1 mod_perl/2.0.2 Perl/v5.8.8 Server at testserver Port 80

[SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch1 mod_perl/2.0.2 Perl/v5.8.8
    [SERVER_NAME] => testserver
    [SERVER_ADDR] => 192.168.101.99
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 192.168.101.114
    [DOCUMENT_ROOT] => /var/www/
    [SERVER_ADMIN] => webmaster@localhost
    [SCRIPT_FILENAME] => /home/thomas/web/php4/Arrays/get_globals.php
    [REMOTE_PORT] => 2400
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] =>
    [REQUEST_URI] => /~thomas/php4/Arrays/get_globals.php
    [SCRIPT_NAME] => /~thomas/php4/Arrays/get_globals.php
    [PHP_SELF] => /~thomas/php4/Arrays/get_globals.php
    [REQUEST_TIME] => 1176825406
    [argv] => Array
        (
        )

[argc] => 0
)

$_SERVER ist dann im Baum von $GLOBALS plötzlich wieder enthalten.
Das Ganze kann doch nur ein Bug sein?

Was sagt Ihr dazu? Ist da schon 'was bekannt?

PHP-Version ist 5.2.0-8

Harzliche Grüße vom Berg
http://www.annerschbarrich.de

Tom

--
Fortschritt entsteht nur durch die Auseinandersetzung der Kreativen
Nur selber lernen macht schlau