@@ -371,6 +371,21 @@ static void zend_file_cache_serialize_zval(zval *zv,
371
371
}
372
372
}
373
373
374
+ static void zend_file_cache_serialize_type (
375
+ zend_type * type , zend_persistent_script * script , zend_file_cache_metainfo * info , void * buf )
376
+ {
377
+ if (ZEND_TYPE_IS_CLASS (* type )) {
378
+ zend_bool allow_null = ZEND_TYPE_ALLOW_NULL (* type );
379
+ zend_string * type_name = ZEND_TYPE_NAME (* type );
380
+
381
+ SERIALIZE_STR (type_name );
382
+ * type =
383
+ (Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 )) | /* type is class */
384
+ (allow_null ? (Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 )) : Z_UL (0 )) | /* type allow null */
385
+ (zend_type )type_name ;
386
+ }
387
+ }
388
+
374
389
static void zend_file_cache_serialize_op_array (zend_op_array * op_array ,
375
390
zend_persistent_script * script ,
376
391
zend_file_cache_metainfo * info ,
@@ -498,16 +513,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
498
513
if (!IS_SERIALIZED (p -> name )) {
499
514
SERIALIZE_STR (p -> name );
500
515
}
501
- if (ZEND_TYPE_IS_CLASS (p -> type )) {
502
- zend_bool allow_null = ZEND_TYPE_ALLOW_NULL (p -> type );
503
- zend_string * type_name = ZEND_TYPE_NAME (p -> type );
504
-
505
- SERIALIZE_STR (type_name );
506
- p -> type =
507
- (Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 )) | /* type is class */
508
- (allow_null ? (Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 )) : Z_UL (0 )) | /* type allow null */
509
- (zend_type )type_name ;
510
- }
516
+ zend_file_cache_serialize_type (& p -> type , script , info , buf );
511
517
p ++ ;
512
518
}
513
519
}
@@ -1080,6 +1086,18 @@ static void zend_file_cache_unserialize_zval(zval *zv,
1080
1086
}
1081
1087
}
1082
1088
1089
+ static void zend_file_cache_unserialize_type (
1090
+ zend_type * type , zend_persistent_script * script , void * buf )
1091
+ {
1092
+ if (* type & (Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 ))) { /* type is class */
1093
+ zend_bool allow_null = (* type & (Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 ))) != 0 ; /* type allow null */
1094
+ zend_string * type_name = (zend_string * )(* type & ~(((Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 ))) | ((Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 )))));
1095
+
1096
+ UNSERIALIZE_STR (type_name );
1097
+ * type = ZEND_TYPE_ENCODE_CLASS (type_name , allow_null );
1098
+ }
1099
+ }
1100
+
1083
1101
static void zend_file_cache_unserialize_op_array (zend_op_array * op_array ,
1084
1102
zend_persistent_script * script ,
1085
1103
void * buf )
@@ -1195,13 +1213,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
1195
1213
if (!IS_UNSERIALIZED (p -> name )) {
1196
1214
UNSERIALIZE_STR (p -> name );
1197
1215
}
1198
- if (p -> type & (Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 ))) { /* type is class */
1199
- zend_bool allow_null = (p -> type & (Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 ))) != 0 ; /* type allow null */
1200
- zend_string * type_name = (zend_string * )(p -> type & ~(((Z_UL (1 ) << (sizeof (zend_type )* 8 - 1 ))) | ((Z_UL (1 ) << (sizeof (zend_type )* 8 - 2 )))));
1201
-
1202
- UNSERIALIZE_STR (type_name );
1203
- p -> type = ZEND_TYPE_ENCODE_CLASS (type_name , allow_null );
1204
- }
1216
+ zend_file_cache_unserialize_type (& p -> type , script , buf );
1205
1217
p ++ ;
1206
1218
}
1207
1219
}
0 commit comments