[RFC] Deprecate is_a() and is_subclass_of() with string when not allowed - #23236
Merged
Merged
Conversation
NickSdot
reviewed
Aug 12, 2026
DanielEScherzer
force-pushed
the
allow-string-false
branch
from
August 12, 2026 19:14
cf54ad0 to
f9a579b
Compare
Girgias
reviewed
Aug 16, 2026
Comment on lines
+718
to
+728
| zend_string *function_name = get_active_function_or_method_name(); | ||
| zend_error( | ||
| E_DEPRECATED, | ||
| "Calling %pS() with a string when $allow_string is false", | ||
| function_name | ||
| ); | ||
| zend_string_release(function_name); | ||
| if (UNEXPECTED(EG(exception))) { | ||
| RETURN_THROWS(); | ||
| } | ||
| RETURN_FALSE; |
Member
There was a problem hiding this comment.
You can determine this using the only_subclass parameter and just have a const char*.
Might also make sense as a follow-up to mark is_a_impl zend_always_inline so the compiler actually inlines the implementation for the two functions.
Member
Author
There was a problem hiding this comment.
Switched to using only_subclass to check
…allowed For `is_a()` and `is_subclass_of()`, emit deprecation warnings when calling with a string as the first argument but with `$allow_string` being false. The two functions share implementation code and so are updated together. https://wiki.php.net/rfc/deprecations_php_8_6
DanielEScherzer
force-pushed
the
allow-string-false
branch
from
August 31, 2026 19:59
f9a579b to
daa6295
Compare
Girgias
approved these changes
Aug 31, 2026
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.
For
is_a()andis_subclass_of(), emit deprecation warnings when calling with a string as the first argument but with$allow_stringbeing false. The two functions share implementation code and so are updated together.https://wiki.php.net/rfc/deprecations_php_8_6