@@ -269,12 +269,13 @@ ZEND_API zend_object *zend_object_make_lazy(zend_object *obj,
269
269
obj = zend_objects_new (reflection_ce );
270
270
271
271
/* Iterate in reverse to avoid overriding Z_PROP_FLAG_P() of child props with added hooks (GH-17870). */
272
- for (int i = obj -> ce -> default_properties_count - 1 ; i >= 0 ; i -- ) {
273
- zval * p = & obj -> properties_table [i ];
272
+ for (uint32_t i = obj -> ce -> default_properties_count - 1 ; i > 0 ; i -- ) {
273
+ uint32_t index = i - 1 ;
274
+ zval * p = & obj -> properties_table [index ];
274
275
ZVAL_UNDEF (p );
275
276
Z_PROP_FLAG_P (p ) = 0 ;
276
277
277
- zend_property_info * prop_info = obj -> ce -> properties_info_table [i ];
278
+ zend_property_info * prop_info = obj -> ce -> properties_info_table [index ];
278
279
if (prop_info ) {
279
280
zval * p = & obj -> properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )];
280
281
Z_PROP_FLAG_P (p ) = IS_PROP_UNINIT | IS_PROP_LAZY ;
@@ -326,7 +327,7 @@ ZEND_API zend_object *zend_object_make_lazy(zend_object *obj,
326
327
}
327
328
328
329
/* unset() declared properties */
329
- for (int i = 0 ; i < reflection_ce -> default_properties_count ; i ++ ) {
330
+ for (uint32_t i = 0 ; i < reflection_ce -> default_properties_count ; i ++ ) {
330
331
zend_property_info * prop_info = obj -> ce -> properties_info_table [i ];
331
332
if (EXPECTED (prop_info )) {
332
333
zval * p = & obj -> properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )];
@@ -390,7 +391,7 @@ ZEND_API zend_object *zend_lazy_object_mark_as_initialized(zend_object *obj)
390
391
391
392
OBJ_EXTRA_FLAGS (obj ) &= ~(IS_OBJ_LAZY_UNINITIALIZED |IS_OBJ_LAZY_PROXY );
392
393
393
- for (int i = 0 ; i < ce -> default_properties_count ; i ++ ) {
394
+ for (uint32_t i = 0 ; i < ce -> default_properties_count ; i ++ ) {
394
395
if (Z_PROP_FLAG_P (& properties_table [i ]) & IS_PROP_LAZY ) {
395
396
ZVAL_COPY_PROP (& properties_table [i ], & default_properties_table [i ]);
396
397
}
@@ -410,7 +411,7 @@ static void zend_lazy_object_revert_init(zend_object *obj, zval *properties_tabl
410
411
ZEND_ASSERT (properties_table_snapshot );
411
412
zval * properties_table = obj -> properties_table ;
412
413
413
- for (int i = 0 ; i < ce -> default_properties_count ; i ++ ) {
414
+ for (uint32_t i = 0 ; i < ce -> default_properties_count ; i ++ ) {
414
415
zend_property_info * prop_info = ce -> properties_info_table [i ];
415
416
if (!prop_info ) {
416
417
continue ;
@@ -532,7 +533,7 @@ static zend_object *zend_lazy_object_init_proxy(zend_object *obj)
532
533
zend_object_dtor_dynamic_properties (obj );
533
534
obj -> properties = NULL ;
534
535
535
- for (int i = 0 ; i < Z_OBJ (retval )-> ce -> default_properties_count ; i ++ ) {
536
+ for (uint32_t i = 0 ; i < Z_OBJ (retval )-> ce -> default_properties_count ; i ++ ) {
536
537
zend_property_info * prop_info = Z_OBJ (retval )-> ce -> properties_info_table [i ];
537
538
if (EXPECTED (prop_info )) {
538
539
zval * prop = & obj -> properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )];
@@ -608,7 +609,7 @@ ZEND_API zend_object *zend_lazy_object_init(zend_object *obj)
608
609
zval * properties_table = obj -> properties_table ;
609
610
properties_table_snapshot = emalloc (sizeof (* properties_table_snapshot ) * ce -> default_properties_count );
610
611
611
- for (int i = 0 ; i < ce -> default_properties_count ; i ++ ) {
612
+ for (uint32_t i = 0 ; i < ce -> default_properties_count ; i ++ ) {
612
613
ZVAL_COPY_PROP (& properties_table_snapshot [i ], & properties_table [i ]);
613
614
if (Z_PROP_FLAG_P (& properties_table [i ]) & IS_PROP_LAZY ) {
614
615
ZVAL_COPY_PROP (& properties_table [i ], & default_properties_table [i ]);
@@ -640,7 +641,7 @@ ZEND_API zend_object *zend_lazy_object_init(zend_object *obj)
640
641
}
641
642
642
643
if (properties_table_snapshot ) {
643
- for (int i = 0 ; i < obj -> ce -> default_properties_count ; i ++ ) {
644
+ for (uint32_t i = 0 ; i < obj -> ce -> default_properties_count ; i ++ ) {
644
645
zval * p = & properties_table_snapshot [i ];
645
646
/* Use zval_ptr_dtor directly here (not zend_object_dtor_property),
646
647
* as any reference type_source will have already been deleted in
@@ -681,7 +682,7 @@ void zend_lazy_object_realize(zend_object *obj)
681
682
zend_lazy_object_del_info (obj );
682
683
683
684
#if ZEND_DEBUG
684
- for (int i = 0 ; i < obj -> ce -> default_properties_count ; i ++ ) {
685
+ for (uint32_t i = 0 ; i < obj -> ce -> default_properties_count ; i ++ ) {
685
686
ZEND_ASSERT (!(Z_PROP_FLAG_P (& obj -> properties_table [i ]) & IS_PROP_LAZY ));
686
687
}
687
688
#endif
@@ -732,12 +733,13 @@ zend_object *zend_lazy_object_clone(zend_object *old_obj)
732
733
zend_object * new_proxy = zend_objects_new (ce );
733
734
734
735
/* Iterate in reverse to avoid overriding Z_PROP_FLAG_P() of child props with added hooks (GH-17870). */
735
- for (int i = ce -> default_properties_count - 1 ; i >= 0 ; i -- ) {
736
- zval * p = & new_proxy -> properties_table [i ];
736
+ for (uint32_t i = ce -> default_properties_count ; i > 0 ; i -- ) {
737
+ uint32_t index = i - 1 ;
738
+ zval * p = & new_proxy -> properties_table [index ];
737
739
ZVAL_UNDEF (p );
738
740
Z_PROP_FLAG_P (p ) = 0 ;
739
741
740
- zend_property_info * prop_info = ce -> properties_info_table [i ];
742
+ zend_property_info * prop_info = ce -> properties_info_table [index ];
741
743
if (prop_info ) {
742
744
zval * p = & new_proxy -> properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )];
743
745
Z_PROP_FLAG_P (p ) = IS_PROP_UNINIT | IS_PROP_LAZY ;
0 commit comments