From:
Operating system: *
PHP version: 5.3.6
Package: Strings related
Bug Type: Feature/Change Request
Bug description:unpack() forces use of associative arrays
Description:
------------
The unpack() function returns only associative arrays. In some situations
it's advantageous to work with an indexed array instead. For example, this
code, parsing a fictional network packet format:
$packet = "\x01\x05\x05\x01\x05\x05\x01";
$values = unpack("Cpadding/nvalue1/Cpadding/nvalue2/Cpadding", $packet);
might be more clear when written this way:
list(, $value1, , $value2, ) = unpack("CnCnC", $packet);
Implementing a fully compatible workaround in userland is at least mildly
annoying (as well as slow), and it's pretty simple to add to the engine.
--
Edit bug report at http://bugs.php.net/bug.php?id=54734&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54734&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54734&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54734&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54734&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54734&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54734&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54734&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54734&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54734&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54734&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54734&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54734&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54734&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54734&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54734&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54734&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54734&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54734&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54734&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54734&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54734&r=mysqlcfg