Skip to content

Commit ce724d1

Browse files
committed
Assert zend_constant exist
If not the enum case does not exist and it is a programming error
1 parent c5d7264 commit ce724d1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Zend/zend_enum.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ ZEND_API void zend_enum_add_case_cstr(zend_class_entry *ce, const char *name, zv
597597

598598
ZEND_API zend_object *zend_enum_get_case(zend_class_entry *ce, zend_string *name) {
599599
zend_class_constant *c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), name);
600+
ZEND_ASSERT(c && "Must be a valid enum case");
600601
ZEND_ASSERT(ZEND_CLASS_CONST_FLAGS(c) & ZEND_CLASS_CONST_IS_CASE);
601602

602603
if (Z_TYPE(c->value) == IS_CONSTANT_AST) {

0 commit comments

Comments
 (0)