#43334 [Csd->Opn]: isset behaviour with multiple parameters
| From: | nicholsr@php.net | Date: | Thu, 22 Nov 2007 14:55:01 +0000 |
| Subject: | #43334 [Csd->Opn]: isset behaviour with multiple parameters | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-259@lists.php.net to get a copy of this message | ||
ID: 43334
User updated by: nicholsr@php.net
Reported By: nicholsr@php.net
-Status: Closed
+Status: Open
Bug Type: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
New Comment:
What was added to the documentation was this:
"If multiple parameters are supplied then isset() will return TRUE only
if all of the parameters are set. Evaluation goes from left to right and
stop as soon as a set variable is encountered."
Unfortunately this is not quite right.
It should say:
"If multiple parameters are supplied then isset() will return TRUE only
if all of the parameters are set. Evaluation goes from left to right and
stop as soon as an unset variable is encountered."
Previous Comments:
------------------------------------------------------------------------
[2007-11-21 11:37:50] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"If multiple parameters are supplied then isset() will return TRUE only
if all of the parameters are set. Evaluation goes from left to right and
stop as soon as a set variable is encountered."
------------------------------------------------------------------------
[2007-11-19 11:59:08] nicholsr@php.net
Description:
------------
The documentation for isset does not clearly describe the behaviour for
multiple parameters.
I suggest that the "Description" is revised by adding the following:
If multiple parameters are supplied then isset will return TRUE only if
all of the parameters are not NULL or unset.
I suggest that the "Notes" is revised by adding the following:
"If multiple parameters are supplied then isset evaluates them in order
left to right. It stops evaluating the parameters as soon as an unset
parameter is encountered."
Reproduce code:
---------------
<?php
echo "this generates a warning about b not being set \n";
var_dump (isset ($a[$b]));
echo "this generates no warning \n";
var_dump (isset ($c, $a[$b]));
?>
Expected result:
----------------
this generates a warning about b not being set
PHP Notice: Undefined variable: b in C:\cygwin\home\nicholsr\1.php on
line 3
bool(false)
this generates no warning
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43334&edit=1