Bug #72906 [Opn->Ver]: getType() now returns FQCN with leading \
| From: | requinix@php.net | Date: | Sat, 20 Aug 2016 16:35:17 +0000 |
| Subject: | Bug #72906 [Opn->Ver]: getType() now returns FQCN with leading \ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-203425@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: requinix@php.net
Reported by: wouter at wouterj dot nl
Summary: getType() now returns FQCN with leading \
-Status: Open
+Status: Verified
Type: Bug
Package: Reflection related
PHP Version: 7.1.0beta3
Block user comment: N
Private report: N
New Comment:
It's being reverted. http://php.markmail.org/thread/7h5nocall4bhsaeh
Previous Comments:
------------------------------------------------------------------------
[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