ID: 40543 Updated by: [EMAIL PROTECTED] Reported By: dedmajor at gmail dot com Status: Feedback Bug Type: Strings related Operating System: linux x86_64 PHP Version: 5.2.1 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2007-04-23 17:19:13] petr dot stastny at centrum dot cz Okay, I will say exactly where I have this problem: PHP 5.2.1 # cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 67 model name : AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ # uname -a Linux silver 2.6.18-8.1.1.el5 #1 SMP Mon Apr 9 09:43:24 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux php -r 'print_r(unpack("N", pack("N", 41445))); returns the same as metioned int the original message about this bug: -2147442203 If you use sprintf('%b',....), you can see: 1111111111111111111111111111111110000000000000001010000111100101 First 32 bits are set to 1. There is no problem on Intel Xeon 64-bit processor as I could test. ------------------------------------------------------------------------ [2007-04-23 09:18:20] [EMAIL PROTECTED] Not reproducible (both on 32bit and 64bit). ------------------------------------------------------------------------ [2007-04-22 18:44:55] petr dot stastny at centrum dot cz Sorry, it is converted to SIGNED int ------------------------------------------------------------------------ [2007-04-22 18:43:53] petr dot stastny at centrum dot cz The problem is that first 32 bits are set to 1 (not 0) in the output of unpack() function, thus it is interpreted as very large number and then converted to unsigned int for PHP representation. ------------------------------------------------------------------------ [2007-04-12 20:11:55] [EMAIL PROTECTED] This isn't bogus, this is a real bug that causes pain. N is there for people writing code that talks to network services that need to convert numbers from network byte order to the native format. Also note that we get a bonus crash bug on 64-bit platforms too: $fail = '\x00\x00\x00\x8c'; $result = unpack('Nsize', $fail); $size = $result['size'] & 0xffffffff; // BANG! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40543 -- Edit this bug report at http://bugs.php.net/?id=40543&edit=1
