note 73681 added to function.unpack
| From: | elpaso at osu1 dot php dot net | Date: | Tue, 06 Mar 2007 13:38:59 +0000 |
| Subject: | note 73681 added to function.unpack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124155@lists.php.net to get a copy of this message | ||
If you are trying to make unpack 'N' work with unsigned long on 64 bit machines, you
should take a look to this bug:
http://bugs.php.net/bug.php?id=40543
An ugly workaround for me was:
//Read a 4-byte integer from file
$_r = fread($f,4);
$a=unpack('Ni',$_r);
$b = sprintf("%b", $a['i']); // binary representation
if(strlen($b) == 64){
$new = substr($b, 33);
$a['i'] = bindec($new);
}
----
Server IP: 213.92.11.19
Probable Submitter: 82.52.88.102
----
Manual Page -- http://www.php.net/manual/en/function.unpack.php
Edit -- https://master.php.net/note/edit/73681
Del: integrated -- https://master.php.net/note/delete/73681/integrated
Del: useless -- https://master.php.net/note/delete/73681/useless
Del: bad code -- https://master.php.net/note/delete/73681/bad+code
Del: spam -- https://master.php.net/note/delete/73681/spam
Del: non-english -- https://master.php.net/note/delete/73681/non-english
Del: in docs -- https://master.php.net/note/delete/73681/in+docs
Del: other reasons-- https://master.php.net/note/delete/73681
Reject -- https://master.php.net/note/reject/73681
Search -- https://master.php.net/manage/user-notes.php