1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Assert zend_constant exist

If not the enum case does not exist and it is a programming error
This commit is contained in:
George Peter Banyard
2023-06-02 17:59:19 +01:00
parent c5d7264149
commit ce724d186d

View File

@@ -597,6 +597,7 @@ ZEND_API void zend_enum_add_case_cstr(zend_class_entry *ce, const char *name, zv
ZEND_API zend_object *zend_enum_get_case(zend_class_entry *ce, zend_string *name) {
zend_class_constant *c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), name);
ZEND_ASSERT(c && "Must be a valid enum case");
ZEND_ASSERT(ZEND_CLASS_CONST_FLAGS(c) & ZEND_CLASS_CONST_IS_CASE);
if (Z_TYPE(c->value) == IS_CONSTANT_AST) {