#27384 [Opn]: Function unpack incorrectly works with string with just one char

From: Date: Tue, 24 Feb 2004 20:23:26 +0000
Subject: #27384 [Opn]: Function unpack incorrectly works with string with just one char
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55477@lists.php.net to get a copy of this message
ID: 27384 User updated by: hayk at mail dot ru Reported By: hayk at mail dot ru Status: Open Bug Type: Unknown/Other Function Operating System: Windows 2000 PHP Version: 4.3.4 New Comment: I muddle up "Expected" and "Actual" results in the my submission. Previous Comments: ------------------------------------------------------------------------ [2004-02-24 15:17:55] hayk at mail dot ru Description: ------------ When the function unpack returns an array with just one element, it doesn't have an index. Reproduce code: --------------- <? $sp = chr(0x20); $a = unpack('C1', $sp); ?> <pre> <? print_r($a); ?> </pre> Expected result: ---------------- Array ( [] => 32 ) Actual result: -------------- Array ( [1] => 32 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27384&edit=1

« previous php.bugs (#55477) next »