Re: wrong implementation of isset()?

From: Date: Tue, 06 Feb 2001 23:58:45 +0000
Subject: Re: wrong implementation of isset()?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-45903@lists.php.net to get a copy of this message
"Mark J. Hershenson" wrote: > >> Great analysis. What about answering the question? Stanislav Malyshev > >> said some months ago this is 'strange', see the discussion around bug > >> 6076. Tell us at least, why this actually isn't strange. > > By default, any unset variable has value NULL - and isset(NULL) returns > > false to indicate that. Similarly, assigning NULL to a variable unsets > > it. > > -Andrei > > * The great thing about standards is that there are so many to choose from. * > Well, sure, isset(NULL) should return false, it's not a variable set in the > scope. A constant(?) yes, but not a variable. > > But if you set a variable at some point in a script, would it not stand to > reason that that name is in the global/local namespace, and therefore IS > set? Perhaps, in order to maintain compatibility, we should re-document is_set, create the documentation for is_null, and look into creating a new function that will determine if something has "ever been inside the namespace", regardless of its current value, or absence of value. Right now, the *documentation* for isset does imply that: $a = NULL; isset($a); //TRUE when this is not the case. Specifically, the documentation says "Returns true if a variable exists" rather than "Returns true if a variable exists, but has not been sunsequently assigned a value (or non-value) of NULL, and has not been unset(). -Ronabop -- Personal: ron@opus1.com, 520-326-6109, http://www.opus1.com/ron/ Work: rchmara@pnsinc.com, 520-546-8993, http://www.pnsinc.com/ The opinions expressed in this email are not neccesarrily those of myself, my employers, or any of the other little voices in my head.

« previous php.dev (#45903) next »