php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48842 Add class_is_instantiable/class_is_abstract functions
Submitted: 2009-07-07 22:33 UTC Modified: 2018-06-24 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: eitan at mosenkis dot net Assigned: cmb (profile)
Status: No Feedback Package: Class/Object related
PHP Version: 5.2.10 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-07-07 22:33 UTC] eitan at mosenkis dot net
Description:
------------
It would be rather useful to have functions to check if a class is abstract/instantiable, given that the only way right now is through ReflectionClass since just trying to instantiate it causes a fatal error which can't be caught.  The usage case is when you use get_declared_classes() to iterate through all available classes and want to instantiate some or all of them, but want to avoid those that will kill your script when you try.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-23 21:06 UTC] jani@php.net
-Package: Feature/Change Request +Package: Class/Object related
 [2018-03-09 12:01 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-03-09 12:01 UTC] cmb@php.net
What's wrong with

  (new ReflectionClass($classname))->isAbstract()
 [2018-06-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 17 05:03:32 2021 UTC