Doc #74842 [Opn->Asn]: The use of "is set" in the definition of isset is vague.
| From: | girgias@php.net | Date: | Sun, 30 Dec 2018 02:45:33 +0000 |
| Subject: | Doc #74842 [Opn->Asn]: The use of "is set" in the definition of isset is vague. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16249@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74842&edit=1
ID: 74842
Updated by: girgias@php.net
Reported by: dominic dot mayers at meditationstudies dot org
Summary: The use of "is set" in the definition of isset is
vague.
-Status: Open
+Status: Assigned
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: girgias
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-08-22 12:19:11] trainingsurat007 at gmail dot com
http://www.training-surat.com/php-training-surat.php
------------------------------------------------------------------------
[2017-07-02 17:13:20] dominic dot mayers at meditationstudies dot org
The fact that unset($v) undo the effect of $v = NULL, also reinforces this other view where $v is
set after $v = NULL. Again, just pointing out that this other view is in the air, It almost feels as
if phpers have adopted the concept that isset does not determine if a variable is set.
------------------------------------------------------------------------
[2017-07-02 16:46:46] dominic dot mayers at meditationstudies dot org
The fact that is_null throws an exception when we use it with a variable that has never been
assigned a value, but not when we have assigned NULL to it, suggests that we should have a different
function, say isset_strict, to determine if a variable has been assigned a NULL or non NULL value to
it. In fact, a few have proposed such a function in the comments. I am not suggesting it should be a
built in function. I am just pointing out that an alternative view on "is set" is in the
air.
However, I feel it is important to bring out clearly, that the current definitions of isset, is_null
and NULL are very harmonious and logical. In particular isset is the opposite of is_null, we unset a
variable if we assign NULL to it, we set a variable if we assign a non NULL value to it and the
purpose of isset is to determine if a variable is set. It's clean and simple.
Note that we did not need the extra "... and is not NULL", which refers to a different
view. However, it is perhaps better not to use "is set", because it might conflict with
the way some people use it.
------------------------------------------------------------------------
[2017-07-02 06:00:58] dominic dot mayers at meditationstudies dot org
Description:
------------
---
From manual page: http://www.php.net/function.isset
---
The definition should not be using "is set". Personally, I say that a variable cannot be
set to NULL. For me, saying otherwise would be a contradiction, because we assign NULL to a variable
to unset it. Others feel it makes sense to say that we set a variable to NULL, why not, it's a
value. The point here is that "is set" is not very helpful in a definition. The extra
"... and is not Null" helps, but it's hard to think because we still have these two
cases.
I am aware that another 8 years old bug mentions that the current definition seems a contradiction
because we add "... and is not NULL". However, it is not a contradiction. It's either
a useful addition, if we can set a variable to NULL, or redundant otherwise, but never a
contradiction. The issue is more with "is set", because having two possible cases brings
confusion.
My native language is not English, but I would think something like "to determine if a variable
has been assigned a non NULL value" would be more informative. The page could further recall
that a way to unset a variable is to assign NULL to it. I would also recall that is_null is the
opposite of isset.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74842&edit=1