@@ -597,8 +597,8 @@ PHP_METHOD(SplFixedArray, __serialize)
597
597
RETURN_THROWS ();
598
598
}
599
599
600
- uint32_t num_properties =
601
- intern -> std . properties ? zend_hash_num_elements (intern -> std . properties ) : 0 ;
600
+ HashTable * ht = zend_std_get_properties ( & intern -> std );
601
+ uint32_t num_properties = zend_hash_num_elements (ht ) ;
602
602
array_init_size (return_value , intern -> array .size + num_properties );
603
603
604
604
/* elements */
@@ -609,17 +609,12 @@ PHP_METHOD(SplFixedArray, __serialize)
609
609
}
610
610
611
611
/* members */
612
- if (intern -> std .properties ) {
613
- ZEND_HASH_FOREACH_STR_KEY_VAL_IND (intern -> std .properties , key , current ) {
614
- /* The properties hash table can also contain the array elements if the properties table was already rebuilt.
615
- * In this case we'd have a NULL key. We can't simply use the properties table in all cases because it's
616
- * potentially out of sync (missing elements, or containing removed elements) and might need a rebuild. */
617
- if (key != NULL ) {
618
- zend_hash_add_new (Z_ARRVAL_P (return_value ), key , current );
619
- Z_TRY_ADDREF_P (current );
620
- }
621
- } ZEND_HASH_FOREACH_END ();
622
- }
612
+ ZEND_HASH_FOREACH_STR_KEY_VAL_IND (ht , key , current ) {
613
+ if (key != NULL ) {
614
+ zend_hash_add_new (Z_ARRVAL_P (return_value ), key , current );
615
+ Z_TRY_ADDREF_P (current );
616
+ }
617
+ } ZEND_HASH_FOREACH_END ();
623
618
}
624
619
625
620
PHP_METHOD (SplFixedArray , __unserialize )
0 commit comments