php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79516 class_exists returns true for disabled classes
Submitted: 2020-04-24 03:14 UTC Modified: 2020-06-17 10:32 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 1 (100.0%)
Same Version:2 (200.0%)
Same OS:2 (200.0%)
From: 392223903 at qq dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 7.2.30 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: 392223903 at qq dot com
New email:
PHP Version: OS:

 

 [2020-04-24 03:14 UTC] 392223903 at qq dot com
Description:
------------
(1).php.ini conf 
    disable_classes = com
(2).php code check
    var_dump(class_exists('Com'));    //return true ? I disabled it! why ?

But the disable_functions configuration item and function_exists method are correct。

this bug in php5.x-php7.x version


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-24 06:33 UTC] requinix@php.net
-Type: Feature/Change Request +Type: Documentation Problem
 [2020-04-24 06:33 UTC] 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.
 [2020-04-24 07:50 UTC] 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 14:49 UTC] requinix@php.net
-Summary: The disable_classes project set in php.ini cannot be checked with php code +Summary: class_exists returns true for disabled classes -Type: Documentation Problem +Type: Bug
 [2020-04-24 14:49 UTC] requinix@php.net
I could have sworn that function_exists returned true... Apparently not.

I don't like the inconsistency either.
 [2020-04-24 14:53 UTC] 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 17:10 UTC] 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-06-17 10:32 UTC] cmb@php.net
-Operating System: win10,win7 +Operating System: *
 [2022-12-24 08:18 UTC] fariba dot shami326 at gmail dot com
I faced similar kind of issue last time, I am still searching for some proper solution.


(https://www.mahealthconnector.me/)php.net
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC