|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80019 get_object_vars() does not return uninitialized properties
Submitted: 2020-08-26 10:22 UTC Modified: 2020-08-28 08:28 UTC
From: brego at hey dot com Assigned: cmb (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 7.4.9 OS: macOS 10.15.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
50 + 37 = ?
Subscribe to this entry?

 [2020-08-26 10:22 UTC] brego at hey dot com
From manual page:

I realize the code works as intended#1 however the documentation of get_object_vars does not mention that uninitialized object properties will not be returned.


Test script:
class A {
    public function get() {

class B extends A {
    public $foo;
    public $bar = 'bar';
    public string $baz;

$b = new B;


Expected result:
array(3) {
  string(3) "bar"
  uninitialized // <- or something different?

Actual result:
array(2) {
  string(3) "bar"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-28 08:28 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-08-28 08:28 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

The documentation states:

| Gets the accessible non-static properties of the given object
| according to scope.

$baz is not accessible[1], though.

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 00:03:37 2021 UTC