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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 6 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 15:01:29 2024 UTC