Zend: add object_init_instantiable_class() API and use it#22212
Draft
Girgias wants to merge 2 commits into
Draft
Zend: add object_init_instantiable_class() API and use it#22212Girgias wants to merge 2 commits into
Girgias wants to merge 2 commits into
Conversation
To remove the need to check (and throw an exception) if a class is instantiable if we know it is.
As those class_entries are known to be instantiable
907f31d to
decf28a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an idea that kinda came up while working on #19797
In most cases when an extension calls
object_init_ex()it's instantiating one of its own classes, and thus it knows it is instantiable. Therefore, I propose to introduce a new API which skips the (albeit cheap) check.The secondary motivation is that I'm not fully certain I agree that it should be the task of
object_init_ex()to check if an object is instantiable. This is especially relevant for #19797 as I would like to have a single API to that checks that the CE is a concrete class, but also that the constructor is actually callable (i.e. public or within scope) prior to attempting to create the object.It is probably possible to convert more
object_init_ex()(especially those in ext/date) but those are not immediately obvious.