Bug #79844 [NEW]: Wrong next array index for value add

From: Date: Mon, 13 Jul 2020 09:56:15 +0000
Subject: Bug #79844 [NEW]: Wrong next array index for value add
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227991@lists.php.net to get a copy of this message
From: michael dot vorisek at email dot cz Operating system: any PHP version: 7.4.8 Package: Scripting Engine problem Bug Type: Bug Bug description:Wrong next array index for value add Description: ------------ No hidden state should be used for next index. In example below, empty array is set and cleared immediatelly. When array is clear, next index should be 0 like when the 2nd (set/clear) line would not be presented. Test script: --------------- $a = []; $a[] = 'x'; unset($a[0]); // this should have zero effect $a[] = 5; // but it has, this value is added under index 1 instead of 0 print_r($a); Expected result: ---------------- Array ( [0] => 5 ) Actual result: -------------- Array ( [1] => 5 ) -- Edit bug report at https://bugs.php.net/bug.php?id=79844&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79844&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79844&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79844&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79844&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79844&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79844&r=support Expected behavior: https://bugs.php.net/fix.php?id=79844&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79844&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79844&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79844&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79844&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79844&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79844&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79844&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79844&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79844&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79844&r=mysqlcfg

« previous php.bugs (#227991) next »