Req #79288 [NEW]: Allow string key array unpacking inside arrays with array_merge semantics
From: caelan89 at gmail dot com
Operating system: n/a
PHP version: 7.4.2
Package: PHP Language Specification
Bug Type: Feature/Change Request
Bug description:Allow string key array unpacking inside arrays with array_merge semantics
Description:
------------
A wise person by the handle of "nikic" once said to me: "Pro tip: Don't
be a total dick in your bug reports, and you might get a more
information reply next time."
He is totally right. Don't be me. Don't go barging in with such an
arrogant and demeaning tone. It does a disservice to all parties
involved.
See: https://bugs.php.net/bug.php?id=79285&edit=2
Please, if you would accept my apology, I am eager to discuss this
feature:
---
You've added array unpacking inside of arrays. However, I feel that it
could benefit from an additional feature.
You do not allow this:
$a1 = [
'test' => 1
];
$a2 = [
'test-2' => 2
];
$a3 = [
...$a1,
...$a2
];
From my understanding, it would be semantically equivalent to:
$a3 = array_merge($a1, $a2);
Test script:
---------------
$a1 = [
'test' => 1
];
$a2 = [
'test-2' => 2
];
$a3 = [
...$a1,
...$a2
];
--
Edit bug report at https://bugs.php.net/bug.php?id=79288&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79288&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79288&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79288&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79288&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79288&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79288&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79288&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79288&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79288&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79288&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79288&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79288&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79288&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79288&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79288&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79288&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79288&r=mysqlcfg
Thread (1 message)
- caelan89 at gmail dot com