Bug #72906 [Ver->Csd]: getType() now returns FQCN with leading \
| From: | stas@php.net | Date: | Sun, 21 Aug 2016 05:43:39 +0000 |
| Subject: | Bug #72906 [Ver->Csd]: getType() now returns FQCN with leading \ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203442@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72906&edit=1
ID: 72906
Updated by: stas@php.net
Reported by: wouter at wouterj dot nl
Summary: getType() now returns FQCN with leading \
-Status: Verified
+Status: Closed
Type: Bug
Package: Reflection related
PHP Version: 7.1.0beta3
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2016-08-20 16:35:16] requinix@php.net
It's being reverted. http://php.markmail.org/thread/7h5nocall4bhsaeh
------------------------------------------------------------------------
[2016-08-20 16:17:35] wouter at wouterj dot nl
Description:
------------
Since PHP 7.1.0-beta3, the ReflectionType::__toString() method returns class names with a leading \.
This breaks applications comparing the return value with a class string (for instance, Symfony see
https://github.com/symfony/symfony/issues/19677)
This behaviour was introduced by https://github.com/php/php-src/pull/2068
Test script:
---------------
<?php
function test(PDO $reflection) {}
$reflection = new ReflectionFunction('test');
var_dump(PDO::class === (string) $reflection->getParameters()[0]->getType());
var_dump((string) $reflection->getParameters()[0]->getType());
Expected result:
----------------
bool(true)
string(3) "PDO"
Actual result:
--------------
bool(false)
string(3) "\PDO"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72906&edit=1