Bug #79804 [NEW]: Reflection doesn't know about DateInterval and DatePeriod properties
From: ondrej at mirtes dot cz
Operating system:
PHP version: 8.0.0alpha1
Package: Reflection related
Bug Type: Bug
Bug description:Reflection doesn't know about DateInterval and DatePeriod properties
Description:
------------
There isn't any PHP version that would know about properties coming from
classes like DateInterval and DatePeriod. I think that PHP 8 is a great
opportunity to fix this.
There are also other classes with the same problem, mainly coming from
ext-dom. Here's a list of how I compensated for that in PHPStan:
https://github.com/phpstan/phpstan-src/blob/069ffbbece0323a1a22557f41237d4b9efd6c521/src/Reflection/PhpDefect/PhpDefectClassReflectionExtension.php
Test script:
---------------
<?php
$ref = new \ReflectionClass(\DateInterval::class);
foreach ($ref->getProperties() as $property) {
var_dump($propertyâ>getName());
}
$ref = new \ReflectionClass(\DatePeriod::class);
foreach ($ref->getProperties() as $property) {
var_dump($propertyâ>getName());
}
Expected result:
----------------
Dumped list of properties from:
https://www.php.net/manual/en/class.dateinterval.php
https://www.php.net/manual/en/class.dateperiod.php
--
Edit bug report at https://bugs.php.net/bug.php?id=79804&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79804&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79804&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79804&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79804&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79804&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79804&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79804&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79804&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79804&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79804&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79804&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79804&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79804&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79804&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79804&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79804&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79804&r=mysqlcfg
Thread (7 messages)
- ondrej at mirtes dot cz