#18680 [NEW]: Logical OR fails after value passes through session
| From: | su-php at bossi dot com | Date: | Wed, 31 Jul 2002 18:53:07 +0000 |
| Subject: | #18680 [NEW]: Logical OR fails after value passes through session | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-15707@lists.php.net to get a copy of this message | ||
From: su-php@bossi.com
Operating system: Win2K
PHP version: 4.1.2
PHP Bug Type: *Programming Data Structures
Bug description: Logical OR fails after value passes through session
PHP version 4.1.1 (Hey it's an internal test bed, no outside connection)
I am saving user options in an array. The array is then saved to the
session.
the basic variables are:
$TIME_FORMAT_12 = 0x01;
$TIME_FORMAT_24 = 0x02;
$DATE_FORMAT_YMD = 0x04;
$DATE_FORMAT_MDY = 0x08;
$DATE_FORMAT_DMY = 0x10;
$opt['time'] = $TIME_FORMAT_24;
$opt['date'] = $DATE_FORMAT_DMY;
At this point, the array holds numeric values. Now $opt[] is saved to the
session. When it is read back in, I believe the two values are no longer
numeric.
If you OR the base values:
echo "Val: ".($TIME_FORMAT_24 | $DATE_FORMAT_DMY);
echo "Val: ".($opt['time'] | $opt['date');
you get 18 or 0x12.
However if you OR the $opt values _after_ they have been retrieved from
the session:
echo "Val: ".($opt['time'] | $opt['date');
you get 36.
I have tried (strval($opt['time']) | strval($opt['date'))) but it still
fails.
I am using the composite value to perform a logical AND to obtain the
settings: if ( $format_in & $DATE_FORMAT_DMY ) within a function.
--
Edit bug report at http://bugs.php.net/?id=18680&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18680&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18680&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18680&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18680&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18680&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18680&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18680&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18680&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18680&r=globals