php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #6979 HTTP_*_VARS arrays contain little or no data
Submitted: 2000-10-02 20:25 UTC Modified: 2001-01-22 21:12 UTC
From: webmaster at dtechcomputer dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.0.2 OS: win32
Private report: No CVE-ID: None
 [2000-10-02 20:25 UTC] webmaster at dtechcomputer dot com
I am new to the Apache/PHP world, so if I have made an error in understanding the functions, I apologize in advance.

Current versions:
Apache 1.3.12 (win32)
PHP 4.0.2
OS WIN98SE

Current ini config:
register_globals = Off
track_vars = On

Problem:
HTTP_*_VARS do not seem to contain data expected?

Example:
From the documentation I understand variables like SERVER_NAME, SCRIPT_NAME, etc, are available directly as strings variables (i.e. $SERVER_NAME) IF register_globals = On and 'track_vars' set to the opposite state
However, when 'register_globals = Off', they need to be accessed via the 'Global Variable Arrays' (i.e. HTTP_*_VARS). And from the PHP documentation it seems the syntax for retrieving this data would be '$HTTP_*_VARS["whatevervariable"]. 
If $SERVER_NAME = "SOMEHOST.COM" with register_globals = On
I would expect..
$HTTP_SERVER_VARS["SERVER_NAME"] = "SOMEHOST.COM with register_globals = Off

All of the $HTTP_*_VARS arrays seem to be empty (or nearly empty). I do get a valid variable from "$HTTP_GET_VARS["sid"] when (http://www.php.net?sid=something), but I would expect the $HTTP_SERVER_VARS{"*"] to contain several values at all times? Most of the other arrays evaluate as FALSE. (i.e. is_array($HTTP_ENV_VARS) = FALSE, is_array($HTTP_COOKIE_VARS) = FALSE).

If I have missed or overlooked something here, please enlighten me?!

Thanks in advance

Dave

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-03 02:41 UTC] waldschrott@php.net
check your php.ini setting "variables_order" and check some configurations, to properly see what arrays are present in the current page try this snipplet

<?php
function test() {
   var_dump($GLOBALS); }
test(); ?>
 [2000-10-03 04:06 UTC] webmaster at dtechcomputer dot com
Your script simply displayed exactly what I said above?
 [2000-10-03 05:29 UTC] waldschrott@php.net
well, rely on! the variable you allowed in "variables_order" are present AND
depending on the SAPI you?re using some VARS are not available

if you?re using CGI, HTTP_SERVER_VARS will only contain PHP_SELF (most likely on win32)
using ApacheModule HTTP_SERVER_VARS will contain many more 

apachemodule: HTTP_SERVER_VARS["SERVER_NAME"]
CGI:          HTTP_ENV_VARS["SERVER_NAME"]

again, check your variables_order (to contain EGPCS) and keep in mind which SAPI you?re using

if there are still problems after that, this would qualify as bug
 [2000-10-03 07:18 UTC] webmaster at dtechcomputer dot com
Your script simply displayed exactly what I said above?
 [2000-10-03 07:21 UTC] webmaster at dtechcomputer dot com
oops sorry, shouldn't have hit refresh
 [2000-10-03 07:35 UTC] webmaster at dtechcomputer dot com
WOW?!

That did give me most of variables I expected (though not in the array I expected them in).
I had all of the arrays defined in my php.ini, but in a different order (GPCES instead of EGPCS). I lieu of a lenghty explaination here, could you point me to some documentation that would explain why the order of the array assignment would effect the results so dramatically and also a pointer to the "SAPI" protocol and it;s meaning/affect.

Again, THANX for the enlightenment!!
 [2000-10-03 07:49 UTC] waldschrott@php.net
SAPI simply means server api, there?s CGI,ISAPI,Apachemod etc. (just call phpinfo() and search for "server api")
and there are some specialities with each of them (eg. ISAPI does not support getenv() IIRC), but I don?t know if these issues are thoroughly documented

the varibles_order EGPCS should have no effect on your HTTP_*_VARS arrays, it only influences the global scope if register_globals=on, please check again if it really does matter which order you?re using and what are the effects

I can only advise you to read the whole manual and followe discussion on eg. php-general@lists.php.net to be absolutely enlightened

maybe this topic needs some more documentation, moved to docu bug
 [2001-01-22 21:12 UTC] jimw@php.net
i think this bug is more confusing than the documentation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 00:01:31 2024 UTC