Req #78188 [NEW]: Make unpack return a 0 indexed array instead of a 1 indexed array

From: Date: Thu, 20 Jun 2019 13:57:41 +0000
Subject: Req #78188 [NEW]: Make unpack return a 0 indexed array instead of a 1 indexed array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221414@lists.php.net to get a copy of this message
From:             girgias
Operating system: 
PHP version:      Next Major Version
Package:          Unknown/Other Function
Bug Type:         Feature/Change Request
Bug description:Make unpack return a 0 indexed array instead of a 1 indexed array

Description:
------------
Currently unpack returns an array which starts with index 1.
This makes it unusable with list() directly as list() only works with 0
indexed arrays so to destructure an unpack array it first needs to go
through array_values().

As this is a BC break I'm marking this Feature Request for next Major.

Sidenote, I tried to understand how PHP implements unpack but I'm
confused as to how and when the array is returned from the function, if
anyone can point me to some up to date documentation about the Zend
engine that covers this bit that would be great as currently,
phpinternalsbook does not cover Arrays in PHP 7

This may be partially related to #54734


-- 
Edit bug report at https://bugs.php.net/bug.php?id=78188&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=78188&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=78188&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=78188&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=78188&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=78188&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=78188&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=78188&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=78188&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=78188&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=78188&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=78188&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=78188&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=78188&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78188&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=78188&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=78188&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=78188&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78188&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=78188&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=78188&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#221414) next »