Req #78351 [NEW]: Possible to check for invalid class
| From: | php at braten dot be | Date: | Mon, 29 Jul 2019 18:14:07 +0000 |
| Subject: | Req #78351 [NEW]: Possible to check for invalid class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222002@lists.php.net to get a copy of this message | ||
From: php at braten dot be
Operating system: Irrelevant
PHP version: Next Minor Version
Package: Scripting Engine problem
Bug Type: Feature/Change Request
Bug description:Possible to check for invalid class
Description:
------------
It should be possible in PHP to check if a class exists or has a certain
method without throwing a fatal error if the class is invalid.
This has become an issue since https://bugs.php.net/bug.php?id=76980 was
fixed, and is described in more detail in
https://github.com/symfony/symfony/issues/32395
This is a feature request for the next version of PHP to allow functions
like get_class_methods, get_class_vars, get_parent_class, is_a,
is_subclass_of, class_exists, class_implements, class_parents,
trait_exists, defined, interface_exists, method_exists, property_exists,
is_callable to be called without throwing a *fatal* error if a class or
interface does not exist.
It can be ok if you later do "new" on the same class, that PHP must
throw a fatal error. But it should be possible to get a negative result
from the above mentioned functions without a fatal error.
Test script:
---------------
https://github.com/derrabus/symfony-32395-reproducer
Expected result:
----------------
Possible to catch the error and resume.
--
Edit bug report at https://bugs.php.net/bug.php?id=78351&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78351&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78351&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78351&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78351&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78351&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78351&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78351&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78351&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78351&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78351&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78351&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78351&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78351&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78351&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78351&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78351&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78351&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78351&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78351&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78351&r=mysqlcfg