Bug->Req #70282 [Asn]: class not shown in reflection exception
| From: | cmb@php.net | Date: | Wed, 19 Aug 2015 17:39:01 +0000 |
| Subject: | Bug->Req #70282 [Asn]: class not shown in reflection exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195349@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70282&edit=1
ID: 70282
Updated by: cmb@php.net
Reported by: info at dynasource dot eu
Summary: class not shown in reflection exception
Status: Assigned
-Type: Bug
+Type: Feature/Change Request
Package: Reflection related
Operating System: W7
PHP Version: 7.0.0beta3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> While I'm here, testing for an empty class name and/or changing
> the message to "Class '%s' does not exist" could help this
> particular case.
I've checked other class related error messages, and it appears
it's customary to have the class name (single-)quoted. As such it
would make sense to change the reflection related error messages
in this regard. However, the other reflection related error
messages would have to be changed as well (properties, functions,
methods etc. should also be quoted), but that would likely break
all 300+ reflection tests, so that's quite some work.
Anyhow, I still don't think the current behavior is a bug,
therefore changing to feature request.
Previous Comments:
------------------------------------------------------------------------
[2015-08-19 10:07:38] info at dynasource dot eu
correct, it was because of an empty classname.
The reason why it appeared was because of using __CLASS__ within a Closure
------------------------------------------------------------------------
[2015-08-19 07:31:17] requinix@php.net
I assume that's in a browser? Please do a View Source, or a right-click Inspect Element (or
whatever), and check the raw HTML for that message. You will probably see the doubled space
"Class does not exist" that @cmb mentioned. If so then it means $class was empty.
Consider doing a var_dump($class) just before that line, too.
While I'm here, testing for an empty class name and/or changing the message to "Class
'%s' does not exist" could help this particular case.
------------------------------------------------------------------------
[2015-08-19 07:20:45] info at dynasource dot eu
Strange. Ive got an image uploaded at:
https://cloud.githubusercontent.com/assets/125726/9287889/20ef278a-432d-11e5-9edf-0a8732f339d1.png
------------------------------------------------------------------------
[2015-08-18 14:29:32] cmb@php.net
> have you seen my attachment? It says it all.
Um, there is no attachment. Please post the code directly here if
it is short, and otherwise use some other service (e.g. pastebin).
------------------------------------------------------------------------
[2015-08-18 14:10:03] info at dynasource dot eu
have you seen my attachment? It says it all.
The error message does not give me any clue about the $class variable, which I wanted to reflect,
but had a wrong namespace so ReflectionClass couldnt find it.
The error message should give me something like:
ReflectionException:
Class "\mynamespace\wrongfolder\MyClass" does not exist.
Instead, I get this:
ReflectionException:
Class does not exist.
IMHO, not very informative ;)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70282
--
Edit this bug report at https://bugs.php.net/bug.php?id=70282&edit=1