Skip to content

Commit

Permalink
Assert zend_constant exist
Browse files Browse the repository at this point in the history
If not the enum case does not exist and it is a programming error
  • Loading branch information
Girgias committed Jun 2, 2023
1 parent c5d7264 commit ce724d1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Zend/zend_enum.c
Expand Up @@ -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) {
Expand Down

0 comments on commit ce724d1

Please sign in to comment.