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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lynjwxm at hotmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 25 11:01:30 2024 UTC