Re: [RFC] Allow non-variable arguments to empty() and isset()
| From: | Nikita Popov | Date: | Mon, 30 Apr 2012 12:39:32 +0000 |
| Subject: | Re: [RFC] Allow non-variable arguments to empty() and isset() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60376@lists.php.net to get a copy of this message | ||
On Mon, Apr 30, 2012 at 9:50 AM, Patrick ALLAERT <patrickallaert@php.net> wrote:
> Hi,
>
> 2012/4/12 Nikita Popov <nikita.ppv@googlemail.com>:
>> PS: I added isset() too, to address the consistency concerns mentioned on IRC.
>
> I would have voted +1 if it didn't contain the isset() change. None of
> the examples used in the isset_with_expr.phpt test seems logic to me.
>
> Care to explain the consistency concerns here?
The concerns came from laruence, so maybe he could drop a comment here
:) Basically, empty() and isset() are very similar in their nature, so
changing only one of them might seem inconsistent.
Personally I don't see much use in allowing expressions in isset().
People being confused by empty(trim($_GET['foo'])) not working is
quite common, but I've never heard of somebody trying to use isset()
on a function call. The name already makes clear that it's intended
for use on variables.
So, I'm not quite sure what I'm supposed to do about this. Should I
add two vote options, one for empty() only, one for both?
Nikita