Re: [PHP] Register globals and ini_set

2005-07-11 Thread Philip Olson

 If i use, at the beginning of my scripts,
 ini_set('register_globals', 0), register globals will be
 turned off?

 if you have php = 4.2.3 yes, otherwise no.
 it has to be set in php.ini, .htaccess, or httpd.conf

You may NEVER set register_globals at runtime with
ini_set() regardless of PHP version.

Regards,
Philip

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Register globals and ini_set

2005-07-10 Thread Richard Lynch
On Fri, July 8, 2005 7:50 am, Terry Romine said:

You *ARE* doing session_start at the top of each page, right?...

Ya gotta do that.

 I was setting the $_SESSION by:
 $_SESSION['var_name'] = this;
 or
 $my_local = this;
 $_SESSION['var_name'] = $my_local;

There *WAS* a bug in PHP [mumble] (4.1.10???) where the $_SESSION data was
leaking out to PHP as a string reference (never mind PHP has no such
data type).

You could detect it by dumping out $_SESSION and you would see an  in
front of all the strings.

So if you later did:

$var_name = '';

Then your $_SESSION['var_name'] was *ALSO* getting set to ''

 I had stopped using session_register() some time back.

 Sporatically meaning that some of my variables are working fine, while
 others seem to become empty when referenced by a later script. These
 scripts were working fine on the older PHP version. I'm sure it's just a
 quick determination as to what to change, and then I can do a global
 update across the site. There are about 20-30 websites that this affects,
 so you can see my frustration in trying to do this by bits and pieces. I
 had done a test file like this:

 test1.php:
 ?php
   $_SESSION['check'] = test 1;
   echo($_SESSION['check']);
 ?
 a href='test2.php'Click/a

 and
 test2.php:
 ?php
   echo($_SESSION['check']);
 ?
 test1.php displays test1 but test2.php displays nothing.

Looks to me more like the more mundane:
You didn't do session_start() at the beginning of both scripts.

Go to Jail.  Do not collect $400.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Register globals and ini_set

2005-07-08 Thread virtualsoftware
Hi,

If i use, at the beginning of my scripts, ini_set('register_globals', 0), 
register globals will be turned off?

Thanks

Re: [PHP] Register globals and ini_set

2005-07-08 Thread Sebastian

if you have php = 4.2.3 yes, otherwise no.
it has to be set in php.ini, .htaccess, or httpd.conf

[EMAIL PROTECTED] wrote:


Hi,

If i use, at the beginning of my scripts, ini_set('register_globals', 0), 
register globals will be turned off?

Thanks
 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Register globals and ini_set

2005-07-08 Thread Terry Romine
I'm having a serious pain with globals.. maybe someone can help.

My major client moved her service from one server to another, and with it, PHP 
went from 4.1 to 4.2+. 
Register Globals was turned off, and when everything failed to work, tech 
support turned them back on via .htaccess. I'm planning to update the hundreds 
of scripts over the next weekend or so, but for right now, 
my $_SESSION['variable'] seem to be failing sporatically. It doesn't seem to 
make a difference whether I have session_start() at the top of the file or not. 

Shouldn't something like this work?
?php
session_start();
$my_local=$_SESSION['global_var'];
echo($my_local);
?

where $global_var is set in one file and then used in another?

Thanks for any help

Terry

-Original Message-
From: Sebastian [EMAIL PROTECTED]
Sent: Jul 8, 2005 6:42 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Register globals and ini_set

if you have php = 4.2.3 yes, otherwise no.
it has to be set in php.ini, .htaccess, or httpd.conf

[EMAIL PROTECTED] wrote:

Hi,

If i use, at the beginning of my scripts, ini_set('register_globals', 0), 
register globals will be turned off?

Thanks
  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Register globals and ini_set

2005-07-08 Thread Jason Barnett
Since you mention the PHP version was old (4.1) then I have to ask: were 
you using the $_SESSION array all along or were you using 
session_register to register session variables?  Although you probably 
aren't since that would be rather easy to debug.


The script in which your global_variable was set makes absolutely no 
difference.  PHP is just looking for the SID someplace anyways (whether 
that's COOKIE, GET or POST) and then it goes and retrieves that session 
that matches that SID.


OK... when you say that it fails sporadically, what do you mean exactly?

Probably, based on what you've just said, you're somehow assigning into 
your $_SESSION variables through the use of global variables that have 
the same name as your $_SESSION indexes.


http://php.net/manual/en/ref.session.php#ini.session.bug-compat-42


--
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Register globals and ini_set

2005-07-08 Thread Terry Romine
I was setting the $_SESSION by:
$_SESSION['var_name'] = this;
or 
$my_local = this;
$_SESSION['var_name'] = $my_local;

I had stopped using session_register() some time back.

Sporatically meaning that some of my variables are working fine, while others 
seem to become empty when referenced by a later script. These scripts were 
working fine on the older PHP version. I'm sure it's just a quick determination 
as to what to change, and then I can do a global update across the site. There 
are about 20-30 websites that this affects, so you can see my frustration in 
trying to do this by bits and pieces. I had done a test file like this:

test1.php:
?php
  $_SESSION['check'] = test 1;
  echo($_SESSION['check']);
?
a href='test2.php'Click/a

and
test2.php:
?php
  echo($_SESSION['check']);
?
test1.php displays test1 but test2.php displays nothing.

Terry

-Original Message-
From: Jason Barnett [EMAIL PROTECTED]
Sent: Jul 8, 2005 9:15 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Register globals and ini_set

Since you mention the PHP version was old (4.1) then I have to ask: were 
you using the $_SESSION array all along or were you using 
session_register to register session variables?  Although you probably 
aren't since that would be rather easy to debug.

The script in which your global_variable was set makes absolutely no 
difference.  PHP is just looking for the SID someplace anyways (whether 
that's COOKIE, GET or POST) and then it goes and retrieves that session 
that matches that SID.

OK... when you say that it fails sporadically, what do you mean exactly?

Probably, based on what you've just said, you're somehow assigning into 
your $_SESSION variables through the use of global variables that have 
the same name as your $_SESSION indexes.

http://php.net/manual/en/ref.session.php#ini.session.bug-compat-42


-- 
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php