Re: [RFC] unset(): return bool if the variable has existed
| From: | Stas Malyshev | Date: | Thu, 07 Mar 2013 08:53:27 +0000 |
| Subject: | Re: [RFC] unset(): return bool if the variable has existed | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66517@lists.php.net to get a copy of this message | ||
Hi!
> Shouldn't this fail a little bit more obvious (-> "loud")? And how is
> this even possible?
Well, for example - __unset is required to do X before unsetting
variable but X fails for one reason or another and the logic dictates
that you can not unset unless X is done (for a real life example, try
exiting an app like word processor with content unsaved and when it asks
you to save/discard/cancel, click on cancel. Bingo - unset interrupted :).
> or there was
> nothing to unset (i.e., it is still not set)?
>
>
> So I guess this is the only useful behaviour. However, I have no idea,
This behavior is already covered by isset, why duplicate it? If - and I
have no idea why - you cared if the variable was set or not, why not
just do isset?
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227