php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72917 Regression in behavior of strval(ReflectionType) + possibly others?
Submitted: 2016-08-22 03:11 UTC Modified: 2016-08-22 05:02 UTC
From: ezzatron at gmail dot com Assigned:
Status: Duplicate Package: Reflection related
PHP Version: 7.1.0beta3 OS: N/A
Private report: No CVE-ID: None
 [2016-08-22 03:11 UTC] ezzatron at gmail dot com
Description:
------------
When getting the string value of a ReflectionType instance that represents a class name, 7.1.0beta3 seems to prefix the value with a namespace separator.

This behavior is inconsistent with the treatment of runtime class names across all other PHP functions, such as get_class(), that do not use a namespace separator prefix.

It is also a regression. 7.1.0_beta1 did not exhibit this issue (not sure about beta 2). 

Test script:
---------------
<?php

$f = function (stdClass $a) {};
$r = new ReflectionFunction($f);
$p = $r->getParameters();
$t = $p[0]->getType();

echo $t;


Expected result:
----------------
stdClass

Actual result:
--------------
\stdClass

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-22 05:02 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2016-08-22 05:02 UTC] requinix@php.net
Duplicate of bug #72906
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 00:01:31 2024 UTC