Skip to content

Commit d085a74

Browse files
committed
Assert on unknown list entry type
1 parent 3642592 commit d085a74

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

Zend/zend_list.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ static void zend_resource_dtor(zend_resource *res)
6666
res->ptr = NULL;
6767

6868
ld = zend_hash_index_find_ptr(&list_destructors, r.type);
69-
if (ld) {
70-
if (ld->list_dtor_ex) {
71-
ld->list_dtor_ex(&r);
72-
}
73-
} else {
74-
zend_error(E_WARNING, "Unknown list entry type (%d)", r.type);
69+
ZEND_ASSERT(ld && "Unknown list entry type");
70+
71+
if (ld->list_dtor_ex) {
72+
ld->list_dtor_ex(&r);
7573
}
7674
}
7775

@@ -191,12 +189,10 @@ void plist_entry_destructor(zval *zv)
191189
zend_rsrc_list_dtors_entry *ld;
192190

193191
ld = zend_hash_index_find_ptr(&list_destructors, res->type);
194-
if (ld) {
195-
if (ld->plist_dtor_ex) {
196-
ld->plist_dtor_ex(res);
197-
}
198-
} else {
199-
zend_error(E_WARNING,"Unknown list entry type (%d)", res->type);
192+
ZEND_ASSERT(ld && "Unknown list entry type");
193+
194+
if (ld->plist_dtor_ex) {
195+
ld->plist_dtor_ex(res);
200196
}
201197
}
202198
free(res);

0 commit comments

Comments
 (0)