php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70226 ReflectionType::isBuiltin reports false for builtin classes
Submitted: 2015-08-10 12:03 UTC Modified: 2015-08-10 12:26 UTC
From: tim_siebels_aurich at yahoo dot de Assigned:
Status: Not a bug Package: Reflection related
PHP Version: 7.0.0beta3 OS: any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tim_siebels_aurich at yahoo dot de
New email:
PHP Version: OS:

 

 [2015-08-10 12:03 UTC] tim_siebels_aurich at yahoo dot de
Description:
------------
ReflectionType::isBuiltin checks for the type not being `object`.
That way *objects* that are built in, are considered *not* `Builtin()`

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

function foobar(ReflectionMethod $noType)
{
}


$r = new ReflectionFunction('foobar');

var_dump($r->getParameters()[0]->getType()->isBuiltin());

Expected result:
----------------
bool(true)

Actual result:
--------------
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-10 12:24 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2015-08-10 12:24 UTC] nikic@php.net
"Bulitin" refers to a buiting types like array, string etc. It does not tell you whether a class type refers to an internal class or not. You can use ReflectionClass->isInternal()  to determine that.
 [2015-08-10 12:26 UTC] nikic@php.net
See also https://github.com/php/php-src/pull/1190, which contains extensive discussion for how this method should be called.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC