Bug #77115 [NEW]: The array contains 2 identical keys
From: boris at korobkov dot su
Operating system: Ubuntu
PHP version: 7.0.32
Package: Arrays related
Bug Type: Bug
Bug description:The array contains 2 identical keys
Description:
------------
The array contains 2 identical keys.
Reproduced in all PHP 7.*.
Not reproduced in PHP 5.6.
Test script:
---------------
<?php
class A {
private $foo = 'fooA';
public function dump() { return get_object_vars($this); }
}
class B extends A {
public $foo = 'fooB';
}
$b = new B();
$object_vars = $b->dump();
var_dump($object_vars);
unset($object_vars['foo']);
var_dump($object_vars);
unset($object_vars['foo']);
var_dump($object_vars);
Expected result:
----------------
The array contains unique keys only.
Actual result:
--------------
array(2) {
["foo"]=>
string(4) "fooB"
["foo"]=>
string(4) "fooA"
}
array(1) {
["foo"]=>
string(4) "fooB"
}
array(0) {
}
--
Edit bug report at https://bugs.php.net/bug.php?id=77115&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77115&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77115&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77115&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77115&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77115&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77115&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77115&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77115&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77115&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77115&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77115&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77115&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77115&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77115&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77115&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77115&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77115&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77115&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77115&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77115&r=mysqlcfg
Thread (6 messages)
- boris at korobkov dot su