Bug #77673 [NEW]: ReflectionClass#getDefaultProperties() produces empty array with existing keys
| From: | ocramius@php.net | Date: | Tue, 26 Feb 2019 23:45:06 +0000 |
| Subject: | Bug #77673 [NEW]: ReflectionClass#getDefaultProperties() produces empty array with existing keys | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219747@lists.php.net to get a copy of this message | ||
From: ocramius
Operating system: Irrelevant
PHP version: Next Minor Version
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionClass#getDefaultProperties() produces empty array with existing keys
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 bug report at https://bugs.php.net/bug.php?id=77673&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77673&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77673&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77673&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77673&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77673&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77673&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77673&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77673&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77673&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77673&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77673&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77673&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77673&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77673&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77673&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77673&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77673&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77673&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77673&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77673&r=mysqlcfg