|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-03-12 11:16 UTC] sam at rmcreative dot ru
Description:
------------
Currently if there's a space in class name such as new \ReflectionClass('\hey\there\is\Space '), it's very hard to get it from error message:
Fatal error: Uncaught exception 'ReflectionException' with message 'Class \hey\t
here\is\Space does not exist' in ...
Would be great to have it like the following:
Fatal error: Uncaught exception 'ReflectionException' with message 'Class "\hey\t
here\is\Space " does not exist' in ...
Test script:
---------------
<?php
new \ReflectionClass('\hey\there\is\Space ');
Expected result:
----------------
Exception with class name in quotes
Actual result:
--------------
Exception with class name w/o quotes
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 02:00:01 2025 UTC |
Don't parse error messages for information. If you want to know if a class exists then use class_exists(). If you don't like that then use a try/catch block. Of course there's also the question of why your code is trying to reflect an invalid class. $class = '\hey\there\is\Space '; try { new ReflectionClass($class); } catch (ReflectionException $re) { echo "'{$class}' does not exist"; }