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

zend_enum: Assert that the case_name is IS_STRING (#21045)

Ideally this function would return the `zend_string*` directly to avoid some
boilerplate code, but at least by including the assertion the intent is clear.
This commit is contained in:
Tim Düsterhus
2026-01-27 14:00:18 +01:00
committed by GitHub
parent 1c81973458
commit 32088b7e30

View File

@@ -50,7 +50,10 @@ ZEND_API zend_result zend_enum_get_case_by_value(zend_object **result, zend_clas
static zend_always_inline zval *zend_enum_fetch_case_name(zend_object *zobj)
{
ZEND_ASSERT(zobj->ce->ce_flags & ZEND_ACC_ENUM);
return OBJ_PROP_NUM(zobj, 0);
zval *name = OBJ_PROP_NUM(zobj, 0);
ZEND_ASSERT(Z_TYPE_P(name) == IS_STRING);
return name;
}
static zend_always_inline zval *zend_enum_fetch_case_value(zend_object *zobj)