php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43665 ReflectionClass is not aware of used namespaces
Submitted: 2007-12-24 00:27 UTC Modified: 2007-12-25 19:12 UTC
From: lars at strojny dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-12-24 (snap) OS: Gentoo Linux (irrelevant)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lars at strojny dot net
New email:
PHP Version: OS:

 

 [2007-12-24 00:27 UTC] lars at strojny dot net
Description:
------------
ReflectionClass does not respect imported classes. This affects ReflectionClass::__construct(), ReflectionClass::implementsInterface() and ReflectionClass::isSubclassOf().

Reproduce code:
---------------
<?php
namespace Base;
interface IFace
{}

class Impl implements IFace
{}

namespace Other;
use Base::IFace;
use Base::Impl;

$reflected = new ReflectionClass('Impl');

Expected result:
----------------
$reflected is an instance of a ReflectionClass for the class Base::Impl

Actual result:
--------------
ReflectionException: Class Impl does not exist

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-25 19:12 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

\'Impl\' is a random string, reflection has no clue where it comes from and which namespaces might be involved. Please use the full name or __NAMESPACE__ constant.
 [2014-06-01 13:12 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=333668
Log: Patch by anonymous #43665
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 13:01:34 2025 UTC