@@ -957,7 +957,8 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
957957
958958 ZEND_HASH_PACKED_FOREACH_PTR (callback_data -> type -> func .args , arg_type ) {
959959 arg_type = ZEND_FFI_TYPE (arg_type );
960- zend_ffi_cdata_to_zval (NULL , args [n ], arg_type , BP_VAR_R , & fci .params [n ], (zend_ffi_flags )(arg_type -> attr & ZEND_FFI_ATTR_CONST ), 0 , 0 );
960+ zend_ffi_cdata_to_zval (NULL , args [n ], arg_type , BP_VAR_R , & fci .params [n ], (zend_ffi_flags )(arg_type -> attr & ZEND_FFI_ATTR_CONST ),
961+ false, false);
961962 n ++ ;
962963 } ZEND_HASH_FOREACH_END ();
963964 }
@@ -1133,7 +1134,7 @@ static zval *zend_ffi_cdata_get(zend_object *obj, zend_string *member, int read_
11331134 return & EG (uninitialized_zval );
11341135 }
11351136
1136- zend_ffi_cdata_to_zval (cdata , cdata -> ptr , type , BP_VAR_R , rv , 0 , 0 , 0 );
1137+ zend_ffi_cdata_to_zval (cdata , cdata -> ptr , type , BP_VAR_R , rv , 0 , false, false );
11371138 return rv ;
11381139}
11391140/* }}} */
@@ -1302,7 +1303,8 @@ static zval *zend_ffi_cdata_read_field(zend_object *obj, zend_string *field_name
13021303 }
13031304 }
13041305 ptr = (void * )(((char * )ptr ) + field -> offset );
1305- zend_ffi_cdata_to_zval (NULL , ptr , field_type , read_type , rv , (cdata -> flags & ZEND_FFI_FLAG_CONST ) | (zend_ffi_flags )field -> is_const , 0 , 0 );
1306+ zend_ffi_cdata_to_zval (NULL , ptr , field_type , read_type , rv , (cdata -> flags & ZEND_FFI_FLAG_CONST ) | (zend_ffi_flags )field -> is_const ,
1307+ false, false);
13061308 } else {
13071309 zend_ffi_bit_field_to_zval (ptr , field , rv );
13081310 }
@@ -1438,7 +1440,7 @@ static zval *zend_ffi_cdata_read_dim(zend_object *obj, zval *offset, int read_ty
14381440 return & EG (uninitialized_zval );
14391441 }
14401442
1441- zend_ffi_cdata_to_zval (NULL , ptr , dim_type , read_type , rv , is_const , 0 , 0 );
1443+ zend_ffi_cdata_to_zval (NULL , ptr , dim_type , read_type , rv , is_const , false, false );
14421444 return rv ;
14431445}
14441446/* }}} */
@@ -1984,7 +1986,8 @@ static zval *zend_ffi_cdata_it_get_current_data(zend_object_iterator *it) /* {{{
19841986 ptr = (void * )((char * )cdata -> ptr + dim_type -> size * iter -> it .index );
19851987
19861988 zval_ptr_dtor (& iter -> value );
1987- zend_ffi_cdata_to_zval (NULL , ptr , dim_type , iter -> by_ref ? BP_VAR_RW : BP_VAR_R , & iter -> value , (cdata -> flags & ZEND_FFI_FLAG_CONST ) | (zend_ffi_flags )(type -> attr & ZEND_FFI_ATTR_CONST ), 0 , 0 );
1989+ zend_ffi_cdata_to_zval (NULL , ptr , dim_type , iter -> by_ref ? BP_VAR_RW : BP_VAR_R , & iter -> value , (cdata -> flags & ZEND_FFI_FLAG_CONST ) | (zend_ffi_flags )(type -> attr & ZEND_FFI_ATTR_CONST ),
1990+ false, false);
19881991 return & iter -> value ;
19891992}
19901993/* }}} */
@@ -2082,7 +2085,7 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
20822085 case ZEND_FFI_TYPE_SINT32 :
20832086 case ZEND_FFI_TYPE_UINT64 :
20842087 case ZEND_FFI_TYPE_SINT64 :
2085- zend_ffi_cdata_to_zval (cdata , ptr , type , BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST , 0 , 0 );
2088+ zend_ffi_cdata_to_zval (cdata , ptr , type , BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST , false, false );
20862089 ht = zend_new_array (1 );
20872090 zend_hash_str_add (ht , "cdata" , sizeof ("cdata" )- 1 , & tmp );
20882091 * is_temp = 1 ;
@@ -2102,7 +2105,8 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
21022105 * is_temp = 1 ;
21032106 return ht ;
21042107 } else {
2105- zend_ffi_cdata_to_zval (NULL , * (void * * )ptr , ZEND_FFI_TYPE (type -> pointer .type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST , 0 , 0 );
2108+ zend_ffi_cdata_to_zval (NULL , * (void * * )ptr , ZEND_FFI_TYPE (type -> pointer .type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST ,
2109+ false, false);
21062110 ht = zend_new_array (1 );
21072111 zend_hash_index_add_new (ht , 0 , & tmp );
21082112 * is_temp = 1 ;
@@ -2115,7 +2119,8 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
21152119 if (key ) {
21162120 if (!f -> bits ) {
21172121 void * f_ptr = (void * )(((char * )ptr ) + f -> offset );
2118- zend_ffi_cdata_to_zval (NULL , f_ptr , ZEND_FFI_TYPE (f -> type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST , 0 , type -> attr & ZEND_FFI_ATTR_UNION );
2122+ zend_ffi_cdata_to_zval (NULL , f_ptr , ZEND_FFI_TYPE (f -> type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST ,
2123+ false, type -> attr & ZEND_FFI_ATTR_UNION );
21192124 zend_hash_add (ht , key , & tmp );
21202125 } else {
21212126 zend_ffi_bit_field_to_zval (ptr , f , & tmp );
@@ -2128,7 +2133,8 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
21282133 case ZEND_FFI_TYPE_ARRAY :
21292134 ht = zend_new_array (type -> array .length );
21302135 for (n = 0 ; n < type -> array .length ; n ++ ) {
2131- zend_ffi_cdata_to_zval (NULL , ptr , ZEND_FFI_TYPE (type -> array .type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST , 0 , 0 );
2136+ zend_ffi_cdata_to_zval (NULL , ptr , ZEND_FFI_TYPE (type -> array .type ), BP_VAR_R , & tmp , ZEND_FFI_FLAG_CONST ,
2137+ false, false);
21322138 zend_hash_index_add (ht , n , & tmp );
21332139 ptr = (void * )(((char * )ptr ) + ZEND_FFI_TYPE (type -> array .type )-> size );
21342140 }
@@ -2509,7 +2515,8 @@ static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read
25092515 }
25102516
25112517 if (sym -> kind == ZEND_FFI_SYM_VAR ) {
2512- zend_ffi_cdata_to_zval (NULL , sym -> addr , ZEND_FFI_TYPE (sym -> type ), read_type , rv , (zend_ffi_flags )sym -> is_const , 0 , 0 );
2518+ zend_ffi_cdata_to_zval (NULL , sym -> addr , ZEND_FFI_TYPE (sym -> type ), read_type , rv , (zend_ffi_flags )sym -> is_const ,
2519+ false, false);
25132520 } else if (sym -> kind == ZEND_FFI_SYM_FUNC ) {
25142521 zend_ffi_cdata * cdata ;
25152522 zend_ffi_type * new_type = emalloc (sizeof (zend_ffi_type ));
@@ -3764,14 +3771,14 @@ static zend_result zend_ffi_validate_var_type(const zend_ffi_type *type, bool al
37643771 zend_ffi_throw_parser_error ("function type is not allowed at line %d" , FFI_G (line ));
37653772 return FAILURE ;
37663773 }
3767- return zend_ffi_validate_type (type , 0 , allow_incomplete_array );
3774+ return zend_ffi_validate_type (type , false , allow_incomplete_array );
37683775}
37693776/* }}} */
37703777
37713778void zend_ffi_validate_type_name (zend_ffi_dcl * dcl ) /* {{{ */
37723779{
37733780 zend_ffi_finalize_type (dcl );
3774- if (zend_ffi_validate_var_type (ZEND_FFI_TYPE (dcl -> type ), 0 ) == FAILURE ) {
3781+ if (zend_ffi_validate_var_type (ZEND_FFI_TYPE (dcl -> type ), false ) == FAILURE ) {
37753782 zend_ffi_cleanup_dcl (dcl );
37763783 LONGJMP (FFI_G (bailout ), FAILURE );
37773784 }
@@ -5369,7 +5376,7 @@ static zend_result zend_ffi_preload_glob(const char *filename) /* {{{ */
53695376 /* pass */
53705377 } else {
53715378 for (i = 0 ; i < globbuf .gl_pathc ; i ++ ) {
5372- zend_ffi * ffi = zend_ffi_load (globbuf .gl_pathv [i ], 1 );
5379+ zend_ffi * ffi = zend_ffi_load (globbuf .gl_pathv [i ], true );
53735380 if (!ffi ) {
53745381 php_globfree (& globbuf );
53755382 return FAILURE ;
@@ -5397,7 +5404,7 @@ static zend_result zend_ffi_preload(char *preload) /* {{{ */
53975404 filename = estrndup (s , e - s );
53985405 s = NULL ;
53995406 if (!is_glob ) {
5400- ffi = zend_ffi_load (filename , 1 );
5407+ ffi = zend_ffi_load (filename , true );
54015408 efree (filename );
54025409 if (!ffi ) {
54035410 return FAILURE ;
@@ -5430,7 +5437,7 @@ static zend_result zend_ffi_preload(char *preload) /* {{{ */
54305437 if (s ) {
54315438 filename = estrndup (s , e - s );
54325439 if (!is_glob ) {
5433- ffi = zend_ffi_load (filename , 1 );
5440+ ffi = zend_ffi_load (filename , true );
54345441 efree (filename );
54355442 if (!ffi ) {
54365443 return FAILURE ;
@@ -6142,7 +6149,7 @@ static zend_result zend_ffi_validate_field_type(const zend_ffi_type *type, zend_
61426149 if (type == struct_type ) {
61436150 zend_ffi_throw_parser_error ("Struct/union can't contain an instance of itself at line %d" , FFI_G (line ));
61446151 return FAILURE ;
6145- } else if (zend_ffi_validate_var_type (type , 1 ) == FAILURE ) {
6152+ } else if (zend_ffi_validate_var_type (type , true ) == FAILURE ) {
61466153 return FAILURE ;
61476154 } else if (struct_type -> attr & ZEND_FFI_ATTR_UNION ) {
61486155 if (type -> attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY ) {
@@ -6412,7 +6419,7 @@ static zend_result zend_ffi_validate_array_element_type(const zend_ffi_type *typ
64126419 zend_ffi_throw_parser_error ("Only the leftmost array can be undimensioned at line %d" , FFI_G (line ));
64136420 return FAILURE ;
64146421 }
6415- return zend_ffi_validate_type (type , 0 , 1 );
6422+ return zend_ffi_validate_type (type , false, true );
64166423}
64176424/* }}} */
64186425
@@ -6472,7 +6479,7 @@ static zend_result zend_ffi_validate_func_ret_type(const zend_ffi_type *type) /*
64726479 zend_ffi_throw_parser_error ("Function returning array is not allowed at line %d" , FFI_G (line ));
64736480 return FAILURE ;
64746481 }
6475- return zend_ffi_validate_incomplete_type (type , 1 , 0 );
6482+ return zend_ffi_validate_incomplete_type (type , true, false );
64766483}
64776484/* }}} */
64786485
@@ -6646,7 +6653,7 @@ void zend_ffi_add_arg(HashTable **args, const char *name, size_t name_len, zend_
66466653 new_type -> pointer .type = arg_dcl -> type ;
66476654 arg_dcl -> type = ZEND_FFI_TYPE_MAKE_OWNED (new_type );
66486655 }
6649- if (zend_ffi_validate_incomplete_type (type , 1 , 1 ) == FAILURE ) {
6656+ if (zend_ffi_validate_incomplete_type (type , true, true ) == FAILURE ) {
66506657 zend_ffi_cleanup_dcl (arg_dcl );
66516658 zend_hash_destroy (* args );
66526659 pefree (* args , FFI_G (persistent ));
@@ -6725,7 +6732,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
67256732 zend_ffi_type * type ;
67266733
67276734 type = ZEND_FFI_TYPE (dcl -> type );
6728- if (zend_ffi_validate_type (type , (dcl -> flags & ZEND_FFI_DCL_STORAGE_CLASS ) == ZEND_FFI_DCL_EXTERN , 1 ) == FAILURE ) {
6735+ if (zend_ffi_validate_type (type , (dcl -> flags & ZEND_FFI_DCL_STORAGE_CLASS ) == ZEND_FFI_DCL_EXTERN , true ) == FAILURE ) {
67296736 zend_ffi_cleanup_dcl (dcl );
67306737 LONGJMP (FFI_G (bailout ), FAILURE );
67316738 }
0 commit comments