You *can* unset it, you just have to unset the place where it really
sits. When you have a global in a function, then unset it, you only
disconnect the variable. unset doesn't destroy a variable, it just
breaks the reference.

As I said in my earlier e-mail, using this *will* work (I tested it):

unset($GLOBALS['_REQUEST']);

$GLOBALS is itself a superglobal.....hmmm, wonder what would happen if
you unset($GLOBALS['GLOBALS'])....

On Thu, 15 Jul 2004 15:25:55 -0700, Dennis Gearon <[EMAIL PROTECTED]> wrote:
> OK, after lots of reading, I find out it's not possible to unset something that has 
> been 'globalized' in a function, nor ANY global value. However, some online manual 
> pages documented that it's possible to assign NULL to the value. Well that's NOT 
> unset.
> 
> But,that got me to thinking. What about assigning an unset variable to the global? 
> IT WORKS!
> 
> Change the line below:
> 
>          unset( $_REQUEST );
> *--to--*
>         $unset_variable;
>         $_REQUEST = $unset_variable;
> 
> VOILA! no more $_REQUEST super_global. Now, I need to see if it can still be 
> assigned to as if it's a super global.
> 
> 
> 
> Dennis Gearon wrote:
> 
> > I have a function in a class that unsets the superglobal $_REQUEST;
> >
> > Well, it's supposed to, it doesn't do it. I'm on version 4.2.3 of PHP.
> > This page:
> >
> >     
> > http://us2.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals
> >
> >
> > says that $_REQUEST is a super global as of version 4.1.0. Is there some
> > bug I don't know about or am I doing something wrong?
> >
> > Here's the code:
> >
> > <?PHP
> > $_REQUEST["var1"]="\"><script>script stuff</script>";
> > $_REQUEST["var2"]="a_string_of_course";
> > $_REQUEST["arr1"]["elem1"]="<script>script stuff2</script>";
> > $_REQUEST["arr1"]["elem2"]="another_string_of_course";
> >
> > if( !defined('TEST_UNSET') ){
> >    define('TEST_UNSET', TRUE);
> >
> >    class abstract_environment{
> >     var $_REQUEST;
> >        function abstract_environment(){
> >         $this->_REQUEST=$_REQUEST;
> >         unset( $_REQUEST );
> >         echo("unset was done");
> >         $this->_clean_all_vars();
> >     }
> >     function _clean_all_vars(){
> >     //ADD OTHER PROCESSING AS NEEDED
> >         $this->_strip_tags_arr( $this->_REQUEST );
> >     }
> >     function _strip_tags_arr( &$arr_or_solo ){
> >         if( isset($arr_or_solo) ){
> >             if( !is_array($arr_or_solo) ){
> >                 $arr_or_solo= strip_tags($arr_or_solo);
> >             } else {
> >                 reset ($arr_or_solo);
> >                 while (list($key, ) = each ($arr_or_solo)) {
> >                     if( isset($arr_or_solo[$key]) ){
> >                         if( is_array($arr_or_solo[$key]) ){
> >                             $this->_strip_tags_arr($arr_or_solo[$key]);
> >                         } else {
> >                             $arr_or_solo[$key] =
> > strip_tags($arr_or_solo[$key]);
> >                         }
> >                     }
> >                 }
> >             }
> >         }
> >     }
> >
> >    }
> > }
> > $abs_env=new abstract_environment;
> > echo "<pre>";
> > print_r($_REQUEST);
> > print_r( $abs_env );
> > echo "</pre>";
> > ?>
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> !DSPAM:40f7048930729073420354!
> 
> 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to