Bug #77673 [Opn->Csd]: ReflectionClass#getDefaultProperties() produces empty array with existing keys
| From: | krakjoe@php.net | Date: | Wed, 27 Feb 2019 08:18:10 +0000 |
| Subject: | Bug #77673 [Opn->Csd]: ReflectionClass#getDefaultProperties() produces empty array with existing keys | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219753@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77673&edit=1
ID: 77673
Updated by: krakjoe@php.net
Reported by: ocramius@php.net
Summary: ReflectionClass#getDefaultProperties() produces
empty array with existing keys
-Status: Open
+Status: Closed
Type: Bug
Package: Reflection related
Operating System: Irrelevant
PHP Version: Next Minor Version
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1ca9d818b8405159ef96cb974a21714881e1146c
Log: Fix #77673 ReflectionClass::getDefaultProperties returns spooky array
Previous Comments:
------------------------------------------------------------------------
[2019-02-26 23:45:06] ocramius@php.net
Description:
------------
ReflectionClass#getDefaultProperties() produces an array with an invisible property when used in
combination with typed properties
Test script:
---------------
<?php
class A {
public B $c;
}
$class = new ReflectionClass(A::class);
$defaults = $class->getDefaultProperties();
var_dump($defaults);
var_dump(array_key_exists('c', $defaults));
Expected result:
----------------
array(0) {
}
bool(false)
Actual result:
--------------
array(1) {
}
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77673&edit=1