From:             [EMAIL PROTECTED]
Operating system: Linux Redhat 7.2
PHP version:      4.0.6
PHP Bug Type:     Variables related
Bug description:  Logical bitwise operator not functioning correctly

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 bug report at: http://bugs.php.net/?id=14942&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to