php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72906 getType() now returns FQCN with leading \
Submitted: 2016-08-20 16:17 UTC Modified: 2016-08-21 05:43 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: wouter at wouterj dot nl Assigned: stas (profile)
Status: Closed Package: Reflection related
PHP Version: 7.1.0beta3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wouter at wouterj dot nl
New email:
PHP Version: OS:

 

 [2016-08-20 16:17 UTC] 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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-20 16:35 UTC] requinix@php.net
-Status: Open +Status: Verified
 [2016-08-20 16:35 UTC] requinix@php.net
It's being reverted. http://php.markmail.org/thread/7h5nocall4bhsaeh
 [2016-08-21 05:43 UTC] stas@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: stas
 [2016-08-21 05:43 UTC] stas@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 05:01:33 2024 UTC