ID:               40749
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ben at ateor dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: OpenBSD amd64 and sparc64
 PHP Version:      5.2.1
 Assigned To:      iliaa


Previous Comments:
------------------------------------------------------------------------

[2007-04-05 13:49:39] ben at ateor dot com

Fix the problem for me, thanks. 
(ps: meanwhile, I can't verify there's no regressions, given how the
testsuite has changed).

------------------------------------------------------------------------

[2007-04-03 22:00:45] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[2007-03-16 14:03:01] martin at netimage dot dk

It appears that the sign bit is taken from LSB instead of MSB

> php -r 'print_r( unpack('N',pack('N',127)));'
Array
(
    [1] => 127
)

> php -r 'print_r( unpack('N',pack('N',128)));'
Array
(
    [1] => -2147483520
)

The last number is 2's complement of -128 for 32 bit integers

Cheers

------------------------------------------------------------------------

[2007-03-14 20:57:41] pz at mysqlperformanceblog dot com

In any case if you call it bug or a feature this is serious behavior
change for something which a lot of people could be depending on. 

It breaks in MySQL 5.2.0 -> 5.2.1  which is minor version upgrade.

------------------------------------------------------------------------

[2007-03-09 09:06:47] windeler at mediafinanz dot de

Here is another example of a problem with unpack on 64bit systems. It
worked in 5.1.6, but with 5.2.1 the results are bogus.

The expected value from the file content is 200, but PHP says
-2147483448 when I echo $a['i'].

<?php
$f = fopen('test.pdf','rb');
//Read a 4-byte integer from file
$a = unpack('Ni',fread($f,4));
echo $a['i'];
fclose($f);
?>

------------------------------------------------------------------------

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/40749

-- 
Edit this bug report at http://bugs.php.net/?id=40749&edit=1

Reply via email to