Bug #79516 [Com]: class_exists returns true for disabled classes
Edit report at https://bugs.php.net/bug.php?id=79516&edit=1
ID: 79516
Comment by: fariba dot shami326 at gmail dot com
Reported by: 392223903 at qq dot com
Summary: class_exists returns true for disabled classes
Status: Open
Type: Bug
Package: *General Issues
Operating System: *
PHP Version: 7.2.30
Block user comment: N
Private report: N
New Comment:
I faced similar kind of issue last time, I am still searching for some proper solution.
(https://www.mahealthconnector.me/)php.net
Previous Comments:
------------------------------------------------------------------------
[2020-04-24 17:10:36] cmb@php.net
The problem is not only class_exists(), but also that
get_declared_classes() does not have an $exclude_disabled
parameter like get_defined_functions(), and that ReflectionClass
is missing an ::isDisabled() method. Same for the respective
interface related functionality, and likely also for traits.
------------------------------------------------------------------------
[2020-04-24 14:53:36] bugreports at gmail dot com
> I could have sworn that function_exists returned true
no, it's the way to go virtually forever to write defensive code for optional stuff like
"read exif data and put it in the database due upload, otherwise you have to type it by
hand"
> I don't like the inconsistency either
yes, class_exists() should behave identical
------------------------------------------------------------------------
[2020-04-24 14:49:41] requinix@php.net
I could have sworn that function_exists returned true... Apparently not.
I don't like the inconsistency either.
------------------------------------------------------------------------
[2020-04-24 07:50:35] 392223903 at qq dot com
This is not a documentation issue. Because using the disable_functions configuration item and
function_exists method to judge is correct
Examples:
1.disable_functions = md5
2.var_dump(function_exists ('md5')); //this return false
disable_classes + class_exists Does not match
disable_functions + function_exists Is a match
------------------------------------------------------------------------
[2020-04-24 06:33:35] requinix@php.net
disable_classes and disable_functions prevent you from using them. It does not block them from being
registered into the engine.
The docs should go into more detail about this behavior.
------------------------------------------------------------------------
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=79516
--
Edit this bug report at https://bugs.php.net/bug.php?id=79516&edit=1
Thread (5 messages)