RE: [PHP4BETA] A quick clarification question about PHP4...
| From: | Samuel Liddicott | Date: | Wed, 01 Sep 1999 12:06:54 +0000 |
| Subject: | RE: [PHP4BETA] A quick clarification question about PHP4... | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3959@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Joey [mailto:joey@samaritan.com]
> Sent: Wednesday, September 01, 1999 12:25 PM
> To: Sander Pilon
> Cc: Samuel Liddicott; Scott Stevenson; php4beta@lists.php.net
> Subject: RE: [PHP4BETA] A quick clarification question about PHP4...
>
> I must admit, the "isset()" changes you are experiencing are (most likely)
> related more to the FIX of unset()...That is the documentation I was
> talking a/b.
>
> http://www.zend.com/downloads.php
> "A true unset() implementation. A variable or element that is unset(), is
> now sent to oblivion in its entirely, no trace remains from it."
>
> Are you having OTHER changes in isset()? I haven't seen any.
>
> Basically, you have most likely been programming around a semi-broken part
> of PHP3, and now it's time to clean all of that up...
Ughh. How grim. Sure unnset can destroy the object referenced in the
static variable, but to destroy the static-ness of the variable. How
un-C/C++/whatever like!! This is very unnatural, I (in my ignorance) insist
that php3 had it right, and that php3 behaves how I would naturally expect.
It is a shock to see it behave this way in php4. I expect unset in a static
variable to leave it unassigned now, and the next time the function is
called.
Its a bad feature to be able to temporarily turn a static variable into a
temporary variable, and NOT BE ABLE to clear the contents without doing
this!
Howabout this, then, for a userland unset:
function my_unset(&$x) {
# any non-existant variable will do...
$x=$unset;
}
This CAN safely be used on static variables. But can someone answer,
whatever Zeev may have intended for php3 and however much the new behaviour
may make his source code more poetic; who expects "un-staticize" to be a
side effect of "un-set"? And seriously, when would any decent programmer
actually WANT this behaviour?
Is there really anybody who is actually now going to use unset() on static
variables?
And do we really expect people NOT to ask how they can persistantly un-set a
static variable? Because surely this is the most common requirement.
Also, is it deliberate that unset on a pass-by-reference argument ($&)
unsets the local reference and not the contents of the passed variable? Is
this part of the same thing?
Sam