Skip to content

Commit f4d9ed1

Browse files
authored
Use consistent type for h on call zend_hash_index_* (#19255)
1 parent 02dab7f commit f4d9ed1

File tree

11 files changed

+42
-42
lines changed

11 files changed

+42
-42
lines changed

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
12061206
ALLOC_HASHTABLE(CG(unlinked_uses));
12071207
zend_hash_init(CG(unlinked_uses), 0, NULL, NULL, 0);
12081208
}
1209-
zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_long)(uintptr_t)ce);
1209+
zend_hash_index_add_empty_element(CG(unlinked_uses), (zend_ulong)(uintptr_t)ce);
12101210
return ce;
12111211
}
12121212
return NULL;

Zend/zend_generators.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static void zend_generator_remove_child(zend_generator_node *node, zend_generato
179179
node->child.single = NULL;
180180
} else {
181181
HashTable *ht = node->child.ht;
182-
zend_hash_index_del(ht, (zend_ulong) child);
182+
zend_hash_index_del(ht, (zend_ulong)(uintptr_t) child);
183183
if (node->children == 2) {
184184
zend_generator *other_child;
185185
ZEND_HASH_FOREACH_PTR(ht, other_child) {
@@ -558,7 +558,7 @@ static void zend_generator_add_child(zend_generator *generator, zend_generator *
558558
node->child.ht = ht;
559559
}
560560

561-
zend_hash_index_add_new_ptr(node->child.ht, (zend_ulong) child, child);
561+
zend_hash_index_add_new_ptr(node->child.ht, (zend_ulong)(uintptr_t) child, child);
562562
}
563563

564564
++node->children;

Zend/zend_inheritance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,7 +3308,7 @@ static void check_unrecoverable_load_failure(const zend_class_entry *ce) {
33083308
* a dependence on the inheritance hierarchy of this specific class. Instead we fall back to
33093309
* a fatal error, as would happen if we did not allow exceptions in the first place. */
33103310
if (CG(unlinked_uses)
3311-
&& zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t)ce) == SUCCESS) {
3311+
&& zend_hash_index_del(CG(unlinked_uses), (zend_ulong)(uintptr_t)ce) == SUCCESS) {
33123312
zend_exception_uncaught_error(
33133313
"During inheritance of %s with variance dependencies", ZSTR_VAL(ce->name));
33143314
}
@@ -3603,7 +3603,7 @@ ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string
36033603
}
36043604

36053605
if (CG(unlinked_uses)) {
3606-
zend_hash_index_del(CG(unlinked_uses), (zend_long)(uintptr_t) ce);
3606+
zend_hash_index_del(CG(unlinked_uses), (zend_ulong)(uintptr_t) ce);
36073607
}
36083608

36093609
orig_linking_class = CG(current_linking_class);

Zend/zend_vm_execute.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend_vm_execute.skl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void init_opcode_serialiser(void)
113113
Z_TYPE_INFO(tmp) = IS_LONG;
114114
for (i = 0; i < zend_handlers_count; i++) {
115115
Z_LVAL(tmp) = i;
116-
zend_hash_index_add(zend_handlers_table, (zend_long)(uintptr_t)zend_opcode_handlers[i], &tmp);
116+
zend_hash_index_add(zend_handlers_table, (zend_ulong)(uintptr_t)zend_opcode_handlers[i], &tmp);
117117
}
118118
}
119119

@@ -124,7 +124,7 @@ ZEND_API void ZEND_FASTCALL zend_serialize_opcode_handler(zend_op *op)
124124
if (!zend_handlers_table) {
125125
init_opcode_serialiser();
126126
}
127-
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
127+
zv = zend_hash_index_find(zend_handlers_table, (zend_ulong)(uintptr_t)op->handler);
128128
ZEND_ASSERT(zv != NULL);
129129
op->handler = (zend_vm_opcode_handler_t)(uintptr_t)Z_LVAL_P(zv);
130130
}
@@ -142,7 +142,7 @@ ZEND_API const void* ZEND_FASTCALL zend_get_opcode_handler_func(const zend_op *o
142142
if (!zend_handlers_table) {
143143
init_opcode_serialiser();
144144
}
145-
zv = zend_hash_index_find(zend_handlers_table, (zend_long)(uintptr_t)op->handler);
145+
zv = zend_hash_index_find(zend_handlers_table, (zend_ulong)(uintptr_t)op->handler);
146146
ZEND_ASSERT(zv != NULL);
147147
return zend_opcode_handler_funcs[Z_LVAL_P(zv)];
148148
#elif ZEND_VM_KIND == ZEND_VM_KIND_CALL

Zend/zend_weakrefs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ static void zend_weakref_register(zend_object *object, void *payload) {
109109
void *tagged_ptr = Z_PTR_P(zv);
110110
if (ZEND_WEAKREF_GET_TAG(tagged_ptr) == ZEND_WEAKREF_TAG_HT) {
111111
HashTable *ht = ZEND_WEAKREF_GET_PTR(tagged_ptr);
112-
zend_hash_index_add_new_ptr(ht, (zend_ulong) payload, payload);
112+
zend_hash_index_add_new_ptr(ht, (zend_ulong)(uintptr_t) payload, payload);
113113
return;
114114
}
115115

116116
/* Convert simple pointer to hashtable. */
117117
HashTable *ht = emalloc(sizeof(HashTable));
118118
zend_hash_init(ht, 0, NULL, NULL, 0);
119-
zend_hash_index_add_new_ptr(ht, (zend_ulong) tagged_ptr, tagged_ptr);
120-
zend_hash_index_add_new_ptr(ht, (zend_ulong) payload, payload);
119+
zend_hash_index_add_new_ptr(ht, (zend_ulong)(uintptr_t) tagged_ptr, tagged_ptr);
120+
zend_hash_index_add_new_ptr(ht, (zend_ulong)(uintptr_t) payload, payload);
121121
/* Replace the single WeakMap or WeakReference entry in EG(weakrefs) with a HashTable with 2 entries in place. */
122122
ZVAL_PTR(zv, ZEND_WEAKREF_ENCODE(ht, ZEND_WEAKREF_TAG_HT));
123123
}
@@ -146,11 +146,11 @@ static void zend_weakref_unregister(zend_object *object, void *payload, bool wea
146146

147147
HashTable *ht = ptr;
148148
#if ZEND_DEBUG
149-
void *old_payload = zend_hash_index_find_ptr(ht, (zend_ulong) payload);
149+
void *old_payload = zend_hash_index_find_ptr(ht, (zend_ulong)(uintptr_t) payload);
150150
ZEND_ASSERT(old_payload && "Weakref not registered?");
151151
ZEND_ASSERT(old_payload == payload);
152152
#endif
153-
zend_hash_index_del(ht, (zend_ulong) payload);
153+
zend_hash_index_del(ht, (zend_ulong)(uintptr_t) payload);
154154
if (zend_hash_num_elements(ht) == 0) {
155155
GC_DEL_FLAGS(object, IS_OBJ_WEAKLY_REFERENCED);
156156
zend_hash_destroy(ht);

ext/intl/msgformat/msgformat_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo,
411411
int32_t len = u_sprintf(temp, "%u", (uint32_t)num_index);
412412
key.append(temp, len);
413413

414-
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, (zend_ulong)num_index);
414+
storedArgType = (Formattable::Type*)zend_hash_index_find_ptr(types, num_index);
415415
} else { //string; assumed to be in UTF-8
416416
intl_stringFromChar(key, ZSTR_VAL(str_index), ZSTR_LEN(str_index), &err.code);
417417

ext/soap/php_encoding.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ static bool soap_check_zval_ref(zval *data, xmlNodePtr node) {
278278
if (Z_TYPE_P(data) == IS_OBJECT) {
279279
data = (zval*)Z_OBJ_P(data);
280280
}
281-
if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data)) != NULL) {
281+
if ((node_ptr = zend_hash_index_find_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)(uintptr_t)data)) != NULL) {
282282
xmlAttrPtr attr = node_ptr->properties;
283283
char *id;
284284
smart_str prefix = {0};
@@ -324,7 +324,7 @@ static bool soap_check_zval_ref(zval *data, xmlNodePtr node) {
324324
smart_str_free(&prefix);
325325
return true;
326326
} else {
327-
zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)data, node);
327+
zend_hash_index_update_ptr(SOAP_GLOBAL(ref_map), (zend_ulong)(uintptr_t)data, node);
328328
}
329329
}
330330
return false;
@@ -335,7 +335,7 @@ static bool soap_check_xml_ref(zval *data, xmlNodePtr node)
335335
zval *data_ptr;
336336

337337
if (SOAP_GLOBAL(ref_map)) {
338-
if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (zend_ulong)node)) != NULL) {
338+
if ((data_ptr = zend_hash_index_find(SOAP_GLOBAL(ref_map), (zend_ulong)(uintptr_t)node)) != NULL) {
339339
if (!Z_REFCOUNTED_P(data) ||
340340
!Z_REFCOUNTED_P(data_ptr) ||
341341
Z_COUNTED_P(data) != Z_COUNTED_P(data_ptr)) {
@@ -351,7 +351,7 @@ static bool soap_check_xml_ref(zval *data, xmlNodePtr node)
351351
static void soap_add_xml_ref(zval *data, xmlNodePtr node)
352352
{
353353
if (SOAP_GLOBAL(ref_map)) {
354-
zend_hash_index_update(SOAP_GLOBAL(ref_map), (zend_ulong)node, data);
354+
zend_hash_index_update(SOAP_GLOBAL(ref_map), (zend_ulong)(uintptr_t)node, data);
355355
}
356356
}
357357

sapi/phpdbg/phpdbg_bp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ PHPDBG_API void phpdbg_set_breakpoint_opcode(const char *name, size_t name_len)
805805

806806
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline) /* {{{ */
807807
{
808-
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline)) {
808+
if (!zend_hash_index_exists(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong)(uintptr_t) opline)) {
809809
phpdbg_breakline_t new_break;
810810

811811
PHPDBG_G(flags) |= PHPDBG_HAS_OPLINE_BP;
@@ -814,7 +814,7 @@ PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline) /* {
814814
new_break.opline = (zend_ulong) opline;
815815
new_break.base = NULL;
816816

817-
zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline, &new_break, sizeof(phpdbg_breakline_t));
817+
zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong)(uintptr_t) opline, &new_break, sizeof(phpdbg_breakline_t));
818818

819819
phpdbg_notice("Breakpoint #%d added at #"ZEND_ULONG_FMT, new_break.id, new_break.opline);
820820
PHPDBG_BREAK_MAPPING(new_break.id, &PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
@@ -1002,7 +1002,7 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_opline(phpdbg_opline_pt
10021002
{
10031003
phpdbg_breakline_t *brake;
10041004

1005-
if ((brake = zend_hash_index_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline)) && brake->base) {
1005+
if ((brake = zend_hash_index_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong)(uintptr_t) opline)) && brake->base) {
10061006
return (phpdbg_breakbase_t *)brake->base;
10071007
}
10081008

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ int phpdbg_skip_line_helper(void) /* {{{ */ {
591591
|| opline->opcode == ZEND_YIELD
592592
|| opline->opcode == ZEND_YIELD_FROM
593593
) {
594-
zend_hash_index_update_ptr(&PHPDBG_G(seek), (zend_ulong) opline, (void *) opline);
594+
zend_hash_index_update_ptr(&PHPDBG_G(seek), (zend_ulong)(uintptr_t) opline, (void *) opline);
595595
}
596596
} while (++opline < op_array->opcodes + op_array->last);
597597

@@ -633,7 +633,7 @@ static void phpdbg_seek_to_end(void) /* {{{ */ {
633633
case ZEND_GENERATOR_RETURN:
634634
case ZEND_YIELD:
635635
case ZEND_YIELD_FROM:
636-
zend_hash_index_update_ptr(&PHPDBG_G(seek), (zend_ulong) opline, (void *) opline);
636+
zend_hash_index_update_ptr(&PHPDBG_G(seek), (zend_ulong)(uintptr_t) opline, (void *) opline);
637637
}
638638
} while (++opline < op_array->opcodes + op_array->last);
639639
}
@@ -647,7 +647,7 @@ PHPDBG_COMMAND(finish) /* {{{ */
647647
}
648648

649649
phpdbg_seek_to_end();
650-
if (zend_hash_index_exists(&PHPDBG_G(seek), (zend_ulong) phpdbg_user_execute_data(EG(current_execute_data))->opline)) {
650+
if (zend_hash_index_exists(&PHPDBG_G(seek), (zend_ulong)(uintptr_t) phpdbg_user_execute_data(EG(current_execute_data))->opline)) {
651651
zend_hash_clean(&PHPDBG_G(seek));
652652
} else {
653653
PHPDBG_G(flags) |= PHPDBG_IN_FINISH;
@@ -664,7 +664,7 @@ PHPDBG_COMMAND(leave) /* {{{ */
664664
}
665665

666666
phpdbg_seek_to_end();
667-
if (zend_hash_index_exists(&PHPDBG_G(seek), (zend_ulong) phpdbg_user_execute_data(EG(current_execute_data))->opline)) {
667+
if (zend_hash_index_exists(&PHPDBG_G(seek), (zend_ulong)(uintptr_t) phpdbg_user_execute_data(EG(current_execute_data))->opline)) {
668668
zend_hash_clean(&PHPDBG_G(seek));
669669
phpdbg_notice("Already at the end of the function");
670670
return SUCCESS;

0 commit comments

Comments
 (0)