#35817 [NEW]: unpack do not work as expected

From: Date: Tue, 27 Dec 2005 09:40:49 +0000
Subject: #35817 [NEW]: unpack do not work as expected
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91103@lists.php.net to get a copy of this message
From:             lynjwxm at hotmail dot com
Operating system: rhel as 3
PHP version:      5.1.1
PHP Bug Type:     Unknown/Other Function
Bug description:  unpack do not work as expected

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)
}

-- 
Edit bug report at http://bugs.php.net/?id=35817&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35817&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35817&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35817&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35817&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35817&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35817&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35817&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35817&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35817&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35817&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35817&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35817&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35817&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35817&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35817&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35817&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35817&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35817&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35817&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35817&r=mysqlcfg


Thread (8 messages)

« previous php.bugs (#91103) next »