php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48085 [PATCH] pack & unpack missing for 64 bit data
Submitted: 2009-04-27 09:19 UTC Modified: 2015-07-07 17:36 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:4 (100.0%)
From: vivekanandan8 at yahoo dot com Assigned: cmb (profile)
Status: Closed Package: Strings related
PHP Version: 5.3.0RC1 OS: *
Private report: No CVE-ID: None
 [2009-04-27 09:19 UTC] vivekanandan8 at yahoo dot com
Description:
------------
In the PHP 5.3,packing and unpacking function is done like Perl,
but like in Perl processing for 64 bit data is missing.Hence  Implemented it and tested it, the source code as follows 
http://www.gnudeveloper.com/software/php-5.3/pack.c

The PHP example code also found at      

http://www.gnudeveloper.com/forum/viewtopic.php?f=4&t=11&p=27#p27
 
  


Reproduce code:
---------------
$vBinData = pack("Q", 0x1234567812345678);
$vHexData = bin2hex($vBinData);
var_dump($vHexData);

list(,$v32Value) = unpack('Q', chr(0x80).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x09));
print $v32Value.'<br>'."\n";
echo hexdec(dechex($v32Value)) . "0x" . dechex($v32Value) . "<br>";

Expected result:
----------------
7856341278563412
0900000000000080


Actual result:
--------------
This is not implemented  like in Perl 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 18:24 UTC] jani@php.net
-Package: Feature/Change Request +Package: Strings related
 [2015-07-07 17:36 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-07-07 17:36 UTC] cmb@php.net
This has been implemented in the meantime, see
<https://wiki.php.net/rfc/pack_unpack_64bit_formats>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 22:01:31 2024 UTC