php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #12557 register_globals can not be set using ini_set.
Submitted: 2001-08-03 13:34 UTC Modified: 2001-08-06 17:21 UTC
From: boyzone_2001 at yahoo dot com Assigned: andy (profile)
Status: Closed Package: Documentation problem
PHP Version: 4.0.4pl1 OS: win/linux both
Private report: No CVE-ID: None
 [2001-08-03 13:34 UTC] boyzone_2001 at yahoo dot com
ok here is my probelm. 

generally in php.ini settings register_globals are ON. 

now anyway i want to have them OFF. 

a quick search through manual found me a function which can change it that is ini_set. 

it requires the directive and the value for it to be passed and it would be changed. 

but even though i change the register_globals it doesnt have any effect. 
below is my code. 



PHP:--------------------------------------------------------------------------------


<?php 

$setting = ini_get('register_globals');

print "Current setting of register_globals is $setting<br>";

$check = ini_set('register_globals','0'); // i have  tried putting 0,'0', off,'off' but all to no avail.

if(! $check)
{
    print "Can not change setting.<br>";
    exit;
}

$new_setting = ini_get('register_globals');

print "New setting of register_globals is $new_setting<br>";

print "Now let us check if it worked. Make sure u have called script with fundoo parameter.<br>e.g. :: script.php?fundoo=something, <br>it would be printed again.<br>";

print "Fundoo is $fundoo";

?>

--------------------------------------------------------------------------------



i have tried to put up every possible value that i can assume but still it doesnt work. 
i have tested this on my win machine it doesnt work. 

and on linux machine too, on which it doesnt work either. 

u can check script here.

http://www.jdk.f2s.com/drms/admin.php?fundoo=something

so the point is that its not possible to change register_globals using ini_set. its not working.

though it works with .htaccess

so i would like u to change wat i mentioned in documentation.
u can change the description in manual regarding ini_set function which says that register_globals can be changed everywhere by specifying PHP_INI_ALL .

it should be PHP_INI_PERDIR|PHP_INI_SYSTEM

thats it,
jd


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-03 14:28 UTC] andy@php.net
this is supposed to happen, think about it.
By the time you get to the ini_set statement, PHP has
already "registered the globals" :)  Use either php.ini,
.htaccess, or httpd.conf
 [2001-08-03 14:32 UTC] andy@php.net
ok, didn't read the whole thing.  Which documentation page
did you see this on?
 [2001-08-03 14:32 UTC] boyzone_2001 at yahoo dot com
yeah i know that.

but atleast in documentation u can chanage it so that other user wont try the same thing.

thats y i am posting this !!
jd
 [2001-08-03 14:34 UTC] boyzone_2001 at yahoo dot com
i found it here.
http://www.php.net/manual/en/function.ini-set.php

jd

 [2001-08-03 14:48 UTC] andy@php.net
i think that the documentation should say that register
globals can be set with .htaccess, php.ini, or httpd.conf.
 [2001-08-03 14:49 UTC] andy@php.net
and not with ini_set
 [2001-08-04 02:44 UTC] boyzone_2001 at yahoo dot com
thats precisely what chang i m suggesting in documentation !!
jd
 [2001-08-06 17:14 UTC] andy@php.net
assigned to myself
 [2001-08-06 17:21 UTC] andy@php.net
fixed, should show up tomorrow.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 06:01:28 2024 UTC