#23441 [Opn->Bgs]: Session variables and ternary operator
| From: | helly@php.net | Date: | Thu, 01 May 2003 17:22:49 +0000 |
| Subject: | #23441 [Opn->Bgs]: Session variables and ternary operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38892@lists.php.net to get a copy of this message | ||
ID: 23441
Updated by: helly@php.net
Reported By: jeremy at wdonline dot com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Windows XP
PHP Version: 4.3.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
but that is not your problem!
you do a = a++;
that equals: temp = a;a = a+1;a = temp;
Previous Comments:
------------------------------------------------------------------------
[2003-05-01 12:21:13] helly@php.net
the ternary operator is bork
------------------------------------------------------------------------
[2003-05-01 12:15:31] jeremy at wdonline dot com
Through many frustrating hours, I think found a bug. The current
session documentation offers this example for setting session variables
using the $_SESSION array:
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
This example, of course, works. However, it is common knowledge the
the ternary operator can achieve the same results in one line:
$_SESSION['count'] =
(!isset($_SESSION['count']))?0:$_SESSION['count']++;
However, this does not work. The session variable always seems to not
be set, as it always retains the value of 0 instead of being
incremented.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23441&edit=1