Bug #76114 [NEW]: unset deletes too much

From: Date: Mon, 19 Mar 2018 10:41:30 +0000
Subject: Bug #76114 [NEW]: unset deletes too much
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214401@lists.php.net to get a copy of this message
From: hgalt at gmx dot net Operating system: server 2012 R2 PHP version: 7.2.3 Package: opcache Bug Type: Bug Bug description:unset deletes too much Description: ------------ When I use unset to dele a specific array inside an array, it deletes the specific array and all array on the same level behind this specific array. My structure: *0: 0: id -> 0 1: name -> Teig 2: doing -> *3: 0: q -> 100 1: u -> g 2: p -> wheat_flour *4: 1: q -> 100 1: u -> g 2: p -> sugar *5: 2: q -> 100 1: u -> g 2: p -> milk 1: count -> 1 2: uidR -> 2 The star infront of the key says that it is an array. If I execute unset($array[0][1]); the array *4 will be deleted but also the next one (*5). If after *5 additional arrays would be follow, these would be also deleted. I know, that in the past this was working, but I am sorry, I don't know when. Test script: --------------- <?php $array [0]= ['id' => 0, 'name' => 'Teig', 'doing' => 'Test']; $array[0][0] = ['q' => '100', 'u' => 'g', 'p' => 'wheat_flour']; $array[0][1] = ['q' => '100', 'u' => 'g', 'p' => 'sugar']; $array[0][2] = ['q' => '100', 'u' => 'g', 'p' => 'milk']; $array[] = ['count' => '1', 'uidR' => '2']; unset($array[0][1]); Expected result: ---------------- *0: 0: id -> 0 1: name -> Teig 2: doing -> *3: 0: q -> 100 1: u -> g 2: p -> wheat_flour *5: 2: q -> 100 1: u -> g 2: p -> milk 1: count -> 1 2: uidR -> 2 Actual result: -------------- *0: 0: id -> 0 1: name -> Teig 2: doing -> *3: 0: q -> 100 1: u -> g 2: p -> wheat_flour 1: count -> 1 2: uidR -> 2 -- Edit bug report at https://bugs.php.net/bug.php?id=76114&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76114&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76114&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76114&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76114&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76114&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76114&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76114&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76114&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76114&r=support Expected behavior: https://bugs.php.net/fix.php?id=76114&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76114&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76114&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76114&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76114&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76114&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76114&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76114&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76114&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76114&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76114&r=mysqlcfg

« previous php.bugs (#214401) next »