php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81218 get_object_vars returns parent class parameters
Submitted: 2021-07-01 15:49 UTC Modified: -
From: mixlion09 at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 8.0.8 OS: *
Private report: No CVE-ID: None
 [2021-07-01 15:49 UTC] mixlion09 at gmail dot com
Description:
------------
Documentation of get_object_vars says "Note that it will only return parameters defined on that object's class, not on its parent class" (from the https://www.php.net/manual/en/function.get-object-vars.php), but it returns parameters of the parent classes as well.

Test script:
---------------
class A {
    public $aProperty;
}

class B extends A {
    public $bProperty;
}

$b = new B();

var_dump(get_object_vars($b));

Expected result:
----------------
No misleading statement in the documentation


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-01 17:10 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/c9bc21cb7302db778f3c519cbe6a9c8286dc08b8
Log: Fix #81218: get_object_vars returns parent class parameters
 [2021-07-01 17:10 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-07-02 02:45 UTC] git@php.net
Automatic comment on behalf of mumumu
Revision: https://github.com/php/doc-ja/commit/bed8639b655296eb516d2ef45f04c68dc3de3954
Log: Fix #81218: get_object_vars returns parent class parameters
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 05:01:35 2024 UTC