#26833 [Fbk->Opn]: Globals not being defined with 'register_globals On' at random

From: Date: Thu, 08 Jan 2004 01:26:35 +0000
Subject: #26833 [Fbk->Opn]: Globals not being defined with 'register_globals On' at random
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-52956@lists.php.net to get a copy of this message
ID: 26833 User updated by: php at f0e dot net Reported By: php at f0e dot net -Status: Feedback +Status: Open Bug Type: *General Issues Operating System: FreeBSD 5.1-RELEASE-p10 PHP Version: 4.3.4 New Comment: I am positive there are no php_* flags in the httpd.conf, but there is: php_flag register_globals off php_value magic_quotes_gpc off in a .htaccess in a different vhost/directory. I configured apache2 with the following: ./configure \ --enable-so \ --enable-ssl \ --enable-rewrite \ --enable-suexec \ --enable-deflate \ --enable-expires \ --enable-headers \ --enable-speling \ --with-suexec-caller=apache \ --with-suexec-docroot=/home \ --with-suexec-logfile=/var/log/suexec_log \ --with-suexec-uidmin=500 \ --with-suexec-gidmin=500 FYI: this error? occurs with the 4.3.5-dev snapshot as well. Are you thinking that it is apache getting confused and allowing custom php flags from other vhosts interfer? Maybe I'm submitting to the wrong bug tracker :) Thanks again Previous Comments: ------------------------------------------------------------------------ [2004-01-07 20:07:24] sniper@php.net One more thing: How was apache2 configured? (what MPM is used?) ------------------------------------------------------------------------ [2004-01-07 20:06:26] sniper@php.net Are you ABSOLUTELY sure there aren't ANY of those php_* flags used ANYWHERE in your httpd.conf/.htaccess files? (in ANY vhost, etc.) ------------------------------------------------------------------------ [2004-01-07 20:02:00] php at f0e dot net I added: var_dump(ini_get('register_globals')); to the top of the code.. When $REMOTE_ADDR was being defined correctly, the first line was 'string(1) "1"'. After a few more refreshes, $REMOTE_ADDR wasn't defined and the first line was changed to 'string(1) "0"'. I do not have a .htaccess file in the script's directory or parent directory nor am I setting any php values in the httpd.conf. I will try the snapshot. Thanks ------------------------------------------------------------------------ [2004-01-07 19:49:59] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip And do you by any chance set any php.ini options inside any .htaccess file or in httpd.conf ? (with php_flag / php_value / php_admin_flag / php_admin_value) Also, check that register_globals is actually 'On' during execution by adding this to your test script: var_dump(ini_get('register_globals')); ------------------------------------------------------------------------ [2004-01-07 19:26:18] php at f0e dot net Description: ------------ Running Apache/2.0.48 and PHP 4.3.4 PHP configuration: './configure' '--with-mysql' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-openssl' '--enable-magic-quotes' '--with-zlib' '--with-gd' '--with-freetype-dir' '--with-jpeg-dir' '--enable-gd-native-ttf' '--enable-mime-magic' '--disable-cgi' '--with-mhash' Changes to the php.ini-dist: 'register_globals = On', 'display_errors = Off', 'log_errors = On' when I attempt to access (normally) global variables (like $REMOTE_ADDR -- I know I should be using $_SERVER[REMOTE_ADDR] but I cannot force my clients to update all their scripts), maybe 1/10th of the time $REMOTE_ADDR is undefined. $_SERVER[REMOTE_ADDR] is defined all the time however. I tried moving back to 4.3.3 which still experiences the same problem. Reproduce code: --------------- <? print "REMOTE_ADDR: '$_SERVER[REMOTE_ADDR]'<br>\n"; print "REMOTE_ADDR: '$REMOTE_ADDR'"; ?> Expected result: ---------------- REMOTE_ADDR: '127.0.0.1'<br> REMOTE_ADDR: '127.0.0.1' Actual result: -------------- REMOTE_ADDR: '127.0.0.1'<br> REMOTE_ADDR: '' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26833&edit=1

« previous php.bugs (#52956) next »