Bug #78901 [Opn]: wrong output of var_dump() for uninitialized typed properties
| From: | cmb@php.net | Date: | Tue, 03 Dec 2019 14:15:31 +0000 |
| Subject: | Bug #78901 [Opn]: wrong output of var_dump() for uninitialized typed properties | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224023@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78901&edit=1
ID: 78901
Updated by: cmb@php.net
Reported by: public at grik dot net
-Summary: wrong output of var_dump() for uninitialized named
properties
+Summary: wrong output of var_dump() for uninitialized typed
properties
Status: Open
Type: Bug
Package: *General Issues
PHP Version: 7.4.0
Block user comment: N
Private report: N
New Comment:
Works as expected on <https://3v4l.org/gvDf5>.
Previous Comments:
------------------------------------------------------------------------
[2019-12-03 13:36:38] public at grik dot net
Description:
------------
var_dump() does not show named properties that were not initialized,
it just shows that _something_ is there
Test script:
---------------
<?php
class A{
public string $x;
}
var_dump(property_exists($A,'x'));//true
var_dump($A); //class A#1 (1) {} // - it counts the property, but hides it
var_dump(new stdClass()); //class stdClass#1 (0) {} - empty object
Expected result:
----------------
class A#1 (1) {
public $x =>
NULL
}
Actual result:
--------------
class A#1 (1) {
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78901&edit=1