Bug #14942 Updated: Logical bitwise operator not functioning correctly
| From: | mfischer@php.net | Date: | Wed, 09 Jan 2002 05:47:45 +0000 |
| Subject: | Bug #14942 Updated: Logical bitwise operator not functioning correctly | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76305@lists.php.net to get a copy of this message | ||
ID: 14942
Updated by: mfischer
Reported By: mchiba@cisco.com
Old Status: Open
Status: Closed
Bug Type: Variables related
Operating System: Linux Redhat 7.2
PHP Version: 4.0.6
New Comment:
This is fixed in > 4.0.6.
Previous Comments:
------------------------------------------------------------------------
[2002-01-08 22:21:02] mchiba@cisco.com
I have two variables that I am trying to logically 'AND' in a bitwise
fashion. This does not work correctly if one of the variables is
initialized to 0xffffffff.
ie if $field and $flags are two variables:
$flags = 0xffffffff;
$field = 0x01;
($flags & $field)? $str = "TRUE" : $str = "FALSE";
echo "$str <br>";
This prints 'FALSE' instead of 'True'!! I tried debugging it with
different values and it seems that if the highest bit is set then the it
does the wrong thing. ie. if $flags is instead initialized to
0x7fffffff then everything works fine!
Here is phpinfo on my system:
Thanks,
Murtaza
PHP Version 4.0.6
System Linux porky.devel.redhat.com 2.4.5-7smp #1 SMP Tue Jun 26
14:19:49 EDT 2001 i686 unknown
Build Date Aug 27 2001
Configure Command './configure' 'i386-redhat-linux' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr'
'--with-config-file-path=/etc' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization'
'--with-apxs=/usr/sbin/apxs' '--with-bz2' '--with-curl'
'--with-db3'
'--with-dom' '--with-exec-dir=/usr/bin' '--with-gd'
'--with-gdbm'
'--with-gettext' '--with-jpeg-dir=/usr' '--with-mm'
'--with-openssl'
'--with-png' '--with-regex=system' '--with-ttf'
'--with-zlib'
'--with-layout=GNU' '--enable-debugger' '--enable-ftp'
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars'
'--enable-yp' '--enable-wddx' '--without-mysql'
'--without-unixODBC'
'--without-oracle' '--without-oci8' '--with-pspell'
'--with-xml'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php.ini
ZEND_DEBUG disabled
Thread Safety disabled
[Zend logo] This program makes use of the Zend scripting language
engine:
Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14942&edit=1