#24766 [Opn->Ver]: strange result array from unpack

From: Date: Thu, 24 Jul 2003 20:25:27 +0000
Subject: #24766 [Opn->Ver]: strange result array from unpack
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44715@lists.php.net to get a copy of this message
 ID:               24766
 Updated by:       sniper@php.net
 Reported By:      spy at spy dot zp dot ua
-Status:           Open
+Status:           Verified
-Bug Type:         Unknown/Other Function
+Bug Type:         Zend Engine 2 problem
 Operating System: FreeBSD 4.8
-PHP Version:      5.0.0b1 (beta1)
+PHP Version:      5CVS-2003-07-24 (dev)


Previous Comments:
------------------------------------------------------------------------

[2003-07-23 07:35:35] spy at spy dot zp dot ua

Description:
------------
Something wrong with result array from unpack.

var_dump prints correct content.
But when I try to access directly to index, that reports "undefined
offset".

Reproduce code:
---------------
$a=unpack('C3',pack("H6","123456"));
var_dump($a);

$k=array_keys($a);
var_dump($k);

$i=$k[0];

print $a[$i];



Expected result:
----------------
Expected result of line 9 is:
18

Actual result:
--------------
Undefined offset:  1 in 1.php on line 9


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24766&edit=1



Thread (4 messages)

« previous php.bugs (#44715) next »