Skip to content

Commit fd8e862

Browse files
committed
poll: fix missing addref for enum array
1 parent 327e7df commit fd8e862

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/standard/io_poll.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,30 +123,37 @@ static zend_result php_io_poll_events_to_event_enums(uint32_t events, zval *even
123123

124124
if (events & PHP_POLL_READ) {
125125
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "Read"));
126+
GC_ADDREF(Z_OBJ(enum_case));
126127
add_next_index_zval(event_enums, &enum_case);
127128
}
128129
if (events & PHP_POLL_WRITE) {
129130
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "Write"));
131+
GC_ADDREF(Z_OBJ(enum_case));
130132
add_next_index_zval(event_enums, &enum_case);
131133
}
132134
if (events & PHP_POLL_ERROR) {
133135
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "Error"));
136+
GC_ADDREF(Z_OBJ(enum_case));
134137
add_next_index_zval(event_enums, &enum_case);
135138
}
136139
if (events & PHP_POLL_HUP) {
137140
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "HangUp"));
141+
GC_ADDREF(Z_OBJ(enum_case));
138142
add_next_index_zval(event_enums, &enum_case);
139143
}
140144
if (events & PHP_POLL_RDHUP) {
141145
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "ReadHangUp"));
146+
GC_ADDREF(Z_OBJ(enum_case));
142147
add_next_index_zval(event_enums, &enum_case);
143148
}
144149
if (events & PHP_POLL_ONESHOT) {
145150
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "OneShot"));
151+
GC_ADDREF(Z_OBJ(enum_case));
146152
add_next_index_zval(event_enums, &enum_case);
147153
}
148154
if (events & PHP_POLL_ET) {
149155
ZVAL_OBJ(&enum_case, zend_enum_get_case_cstr(php_io_poll_event_class_entry, "EdgeTriggered"));
156+
GC_ADDREF(Z_OBJ(enum_case));
150157
add_next_index_zval(event_enums, &enum_case);
151158
}
152159

0 commit comments

Comments
 (0)