|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20224 Constants / Global variables non printable
Submitted: 2002-11-02 20:12 UTC Modified: 2002-11-02 21:30 UTC
From: phresno at concept-factory dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.2 OS: Slackware Linux Kernel 2.4.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: phresno at concept-factory dot com
New email:
PHP Version: OS:


 [2002-11-02 20:12 UTC] phresno at concept-factory dot com
I'm not sure if this is a problem with constants and pre-registered globals, or the printing mechanism.

When setting up a constant such as this:
define("SELF", $SCRIPT_NAME);

and then printing with any of the following:
echo SELF;
pritnf("%s", SELF);

The output is nothing, however, if I do this:
printf("%s", SELF . "?foo=bar");

it will print properly.

I believe it's a problem with the globals, as when I try just to print $SCRIPT_NAME or $SCRIPT_FILENAME I go no output unless I concat'ed it to something else such as shown above.

My PHP configuration is as such:
'./configure' '--with-apxs=/usr/sbin/apxs' '--disable-short-tags' '--enable-bcmath' '--with-zlib-dir=/usr/lib' '--enable-ftp' '--with-gd=/usr/local/gd-1.8.4' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr/lib' '--enable-sockets' '--without-mysql' '--with-pgsql=/usr/local/pgsql'

On Slackware (8.0) Linux, Kernel 2.4.5, Apache 1.3.20. For this particular script, I was working with sessions, and DID use the following lines to disable some sessions settings:
ini_set("session.use_cookies", 0);
ini_set("session.use_trans_sid", 0);

The script was written prior to 4.2.2 and the auto enabled trans_sid was creating extra data in my GET's that I had already accounted for in my own script.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-02 21:30 UTC]
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2002-11-03 12:39 UTC] phresno at concept-factory dot com
Even with register_globals off, why does it sometimes print, and sometimes not? If it's not registering the global it should never print the contents of the global.

Thus both:
printf("%s", $SCRIPT_NAME);
printf("%s", $SCRIPT_NAME . "?foo=bar");

Should never print the contents of $SCRIPT_NAME, however, in the second instance, it prints the contents of $SCRIPT_NAME, even with register_globals off.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 23:01:29 2024 UTC