php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35817 unpack do not work as expected
Submitted: 2005-12-27 10:40 UTC Modified: 2005-12-29 02:48 UTC
From: lynjwxm at hotmail dot com Assigned:
Status: Closed Package: Strings related
PHP Version: 5.1.1 OS: rhel as 3
Private report: No CVE-ID: None
 [2005-12-27 10:40 UTC] lynjwxm at hotmail dot com
Description:
------------
(sorry for my poor english.....)
It seems unpack can not deal with an odd number of hex string args. Under a xterm, it will cause "xterm" displayed on term. 

Reproduce code:
---------------
<?php
$a=pack("H3i","181",5);
$b=unpack("H3/ias",$a);
var_dump($b);
?>

Expected result:
----------------
array(2){
[1]=>
string(3)"181"
["as"]=>
int(5)
}

Actual result:
--------------
array(2){
[1]=>
string(2)"18"
["as"]=>
int(1296)
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-28 21:57 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC