Bug #80686 [NEW]: PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property.
| From: | darrens at gmail dot com | Date: | Fri, 29 Jan 2021 16:21:45 +0000 |
| Subject: | Bug #80686 [NEW]: PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231832@lists.php.net to get a copy of this message | ||
From: darrens at gmail dot com
Operating system: Ubuntu 20.04.2
PHP version: 7.4.14
Package: Class/Object related
Bug Type: Bug
Bug description:PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property.
Description:
------------
Specific PHP Version is 7.4.3 (Default PHP version installed with
Ubuntu).
PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property. I
encountered this bug while using PHPStan:
https://github.com/phpstan/phpstan/issues/4454
and package maintainer
referenced a second related instance:
https://github.com/phpstan/phpstan/issues/4445
Test script:
---------------
https://3v4l.org/oL3Ke
<?php declare(strict_types = 1);
class Client
{
/**
* Pass Login variable
*
* @var array<string, string|null>
*/
private array $_login, $_created_ip;
}
$ref = new \ReflectionClass(Client::class);
foreach ($ref->getProperties() as $prop) {
var_dump($prop->getDocComment());
}
Expected result:
----------------
string(84) "/**
* Pass Login variable
*
* @var array<string, string|null>
*/"
Actual result:
--------------
string(84) "/**
* Pass Login variable
*
* @var array<string, string|null>
*/"
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=80686&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80686&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80686&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80686&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80686&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80686&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80686&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80686&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80686&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80686&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80686&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80686&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80686&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80686&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80686&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80686&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80686&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80686&r=mysqlcfg