|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77115 The array contains 2 identical keys
Submitted: 2018-11-06 12:56 UTC Modified: 2018-11-06 13:50 UTC
From: boris at korobkov dot su Assigned:
Status: Re-Opened Package: Arrays related
PHP Version: 7.0.32 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-11-06 12:56 UTC] boris at korobkov dot su
The array contains 2 identical keys.
Reproduced in all PHP 7.*.
Not reproduced in PHP 5.6.

Test script:

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();



Expected result:
The array contains unique keys only.

Actual result:
array(2) {
  string(4) "fooB"
  string(4) "fooA"

array(1) {
  string(4) "fooB"

array(0) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-06 13:04 UTC]
I've fixed this issue for PHP 7.4 some time ago via I guess we'll have to backport it now :)
 [2018-11-06 13:37 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: bwoebi
 [2018-11-06 13:37 UTC]
-Status: Closed +Status: Re-Opened -Assigned To: bwoebi +Assigned To:
 [2018-11-06 13:37 UTC]
Eih, yeah, backporting is possibly a good idea.
 [2018-11-06 13:50 UTC]
@bwoebi: I don't think we'll want to backport the fix for dynamic properties as it's more intrusive, but the one for declared properties should be relatively self-contained.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Dec 10 08:01:24 2018 UTC