php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_extensions.h File Reference
#include "zend_compile.h"
#include "zend_build.h"

Go to the source code of this file.

Data Structures

struct  _zend_extension_version_info
 
struct  _zend_extension
 

Macros

#define ZEND_EXTENSION_API_NO   420240924
 
#define ZEND_EXTENSION_BUILD_ID   "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
 
#define ZEND_EXTMSG_NEW_EXTENSION   1
 
#define ZEND_EXTENSION()
 
#define STANDARD_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
 
#define COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
 
#define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
 
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR   (1<<0)
 
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR   (1<<1)
 
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER   (1<<2)
 
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC   (1<<3)
 
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST   (1<<4)
 

Typedefs

typedef struct _zend_extension_version_info zend_extension_version_info
 
typedef struct _zend_extension zend_extension
 
typedef int(* startup_func_t) (zend_extension *extension)
 
typedef void(* shutdown_func_t) (zend_extension *extension)
 
typedef void(* activate_func_t) (void)
 
typedef void(* deactivate_func_t) (void)
 
typedef void(* message_handler_func_t) (int message, void *arg)
 
typedef void(* op_array_handler_func_t) (zend_op_array *op_array)
 
typedef void(* statement_handler_func_t) (zend_execute_data *frame)
 
typedef void(* fcall_begin_handler_func_t) (zend_execute_data *frame)
 
typedef void(* fcall_end_handler_func_t) (zend_execute_data *frame)
 
typedef void(* op_array_ctor_func_t) (zend_op_array *op_array)
 
typedef void(* op_array_dtor_func_t) (zend_op_array *op_array)
 
typedef size_t(* op_array_persist_calc_func_t) (zend_op_array *op_array)
 
typedef size_t(* op_array_persist_func_t) (zend_op_array *op_array, void *mem)
 

Functions

ZEND_API int zend_get_resource_handle (const char *module_name)
 
ZEND_API int zend_get_op_array_extension_handle (const char *module_name)
 
ZEND_API int zend_get_op_array_extension_handles (const char *module_name, int handles)
 
ZEND_API int zend_get_internal_function_extension_handle (const char *module_name)
 
ZEND_API int zend_get_internal_function_extension_handles (const char *module_name, int handles)
 
ZEND_API void zend_extension_dispatch_message (int message, void *arg)
 
void zend_extension_dtor (zend_extension *extension)
 
ZEND_API void zend_append_version_info (const zend_extension *extension)
 
void zend_startup_extensions_mechanism (void)
 
void zend_startup_extensions (void)
 
void zend_shutdown_extensions (void)
 
ZEND_API size_t zend_internal_run_time_cache_reserved_size (void)
 
ZEND_API void zend_init_internal_run_time_cache (void)
 
ZEND_API void zend_reset_internal_run_time_cache (void)
 
ZEND_API zend_result zend_load_extension (const char *path)
 
ZEND_API zend_result zend_load_extension_handle (DL_HANDLE handle, const char *path)
 
ZEND_API void zend_register_extension (zend_extension *new_extension, DL_HANDLE handle)
 
ZEND_API zend_extensionzend_get_extension (const char *extension_name)
 
ZEND_API size_t zend_extensions_op_array_persist_calc (zend_op_array *op_array)
 
ZEND_API size_t zend_extensions_op_array_persist (zend_op_array *op_array, void *mem)
 

Variables

ZEND_API int zend_op_array_extension_handles
 
ZEND_API zend_llist zend_extensions
 
ZEND_API uint32_t zend_extension_flags
 

Macro Definition Documentation

◆ BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES

#define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1

Definition at line 132 of file zend_extensions.h.

◆ COMPAT_ZEND_EXTENSION_PROPERTIES

#define COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1

Definition at line 131 of file zend_extensions.h.

◆ STANDARD_ZEND_EXTENSION_PROPERTIES

#define STANDARD_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1

Definition at line 130 of file zend_extensions.h.

◆ ZEND_EXTENSION

#define ZEND_EXTENSION ( )
Value:
#define ZEND_EXT_API
struct _zend_extension_version_info zend_extension_version_info
#define ZEND_EXTENSION_BUILD_ID
#define ZEND_EXTENSION_API_NO

Definition at line 127 of file zend_extensions.h.

◆ ZEND_EXTENSION_API_NO

#define ZEND_EXTENSION_API_NO   420240924

Definition at line 47 of file zend_extensions.h.

◆ ZEND_EXTENSION_BUILD_ID

◆ ZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR

#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR   (1<<0)

Definition at line 138 of file zend_extensions.h.

◆ ZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR

#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR   (1<<1)

Definition at line 139 of file zend_extensions.h.

◆ ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER

#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER   (1<<2)

Definition at line 140 of file zend_extensions.h.

◆ ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST

#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST   (1<<4)

Definition at line 142 of file zend_extensions.h.

◆ ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC

#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC   (1<<3)

Definition at line 141 of file zend_extensions.h.

◆ ZEND_EXTMSG_NEW_EXTENSION

#define ZEND_EXTMSG_NEW_EXTENSION   1

Definition at line 124 of file zend_extensions.h.

Typedef Documentation

◆ activate_func_t

typedef void(* activate_func_t) (void)

Definition at line 61 of file zend_extensions.h.

◆ deactivate_func_t

typedef void(* deactivate_func_t) (void)

Definition at line 62 of file zend_extensions.h.

◆ fcall_begin_handler_func_t

typedef void(* fcall_begin_handler_func_t) (zend_execute_data *frame)

Definition at line 69 of file zend_extensions.h.

◆ fcall_end_handler_func_t

typedef void(* fcall_end_handler_func_t) (zend_execute_data *frame)

Definition at line 70 of file zend_extensions.h.

◆ message_handler_func_t

typedef void(* message_handler_func_t) (int message, void *arg)

Definition at line 64 of file zend_extensions.h.

◆ op_array_ctor_func_t

typedef void(* op_array_ctor_func_t) (zend_op_array *op_array)

Definition at line 72 of file zend_extensions.h.

◆ op_array_dtor_func_t

typedef void(* op_array_dtor_func_t) (zend_op_array *op_array)

Definition at line 73 of file zend_extensions.h.

◆ op_array_handler_func_t

typedef void(* op_array_handler_func_t) (zend_op_array *op_array)

Definition at line 66 of file zend_extensions.h.

◆ op_array_persist_calc_func_t

typedef size_t(* op_array_persist_calc_func_t) (zend_op_array *op_array)

Definition at line 74 of file zend_extensions.h.

◆ op_array_persist_func_t

typedef size_t(* op_array_persist_func_t) (zend_op_array *op_array, void *mem)

Definition at line 75 of file zend_extensions.h.

◆ shutdown_func_t

typedef void(* shutdown_func_t) (zend_extension *extension)

Definition at line 60 of file zend_extensions.h.

◆ startup_func_t

typedef int(* startup_func_t) (zend_extension *extension)

Definition at line 59 of file zend_extensions.h.

◆ statement_handler_func_t

typedef void(* statement_handler_func_t) (zend_execute_data *frame)

Definition at line 68 of file zend_extensions.h.

◆ zend_extension

Definition at line 56 of file zend_extensions.h.

◆ zend_extension_version_info

Function Documentation

◆ zend_append_version_info()

ZEND_API void zend_append_version_info ( const zend_extension * extension)

Definition at line 1284 of file zend.c.

◆ zend_extension_dispatch_message()

ZEND_API void zend_extension_dispatch_message ( int message,
void * arg )

Definition at line 253 of file zend_extensions.c.

◆ zend_extension_dtor()

void zend_extension_dtor ( zend_extension * extension)

Definition at line 229 of file zend_extensions.c.

◆ zend_extensions_op_array_persist()

ZEND_API size_t zend_extensions_op_array_persist ( zend_op_array * op_array,
void * mem )

Definition at line 416 of file zend_extensions.c.

◆ zend_extensions_op_array_persist_calc()

ZEND_API size_t zend_extensions_op_array_persist_calc ( zend_op_array * op_array)

Definition at line 402 of file zend_extensions.c.

◆ zend_get_extension()

ZEND_API zend_extension * zend_get_extension ( const char * extension_name)

Definition at line 364 of file zend_extensions.c.

◆ zend_get_internal_function_extension_handle()

ZEND_API int zend_get_internal_function_extension_handle ( const char * module_name)

Definition at line 306 of file zend_extensions.c.

◆ zend_get_internal_function_extension_handles()

ZEND_API int zend_get_internal_function_extension_handles ( const char * module_name,
int handles )

Definition at line 313 of file zend_extensions.c.

◆ zend_get_op_array_extension_handle()

ZEND_API int zend_get_op_array_extension_handle ( const char * module_name)

The handle returned by this function can be used with ZEND_OP_ARRAY_EXTENSION(op_array, handle).

The extension slot has been available since PHP 7.4 on user functions and has been available since PHP 8.2 on internal functions.

Safety

The extension slot made available by calling this function is initialized on the first call made to the function in that request. If you need to initialize it before this point, call zend_init_func_run_time_cache.

The function cache slots are not available if the function is a trampoline, which can be checked with something like:

if (fbc->type == ZEND_USER_FUNCTION
    && !(fbc->op_array.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)
) {
    // Use ZEND_OP_ARRAY_EXTENSION somehow
}

Definition at line 290 of file zend_extensions.c.

◆ zend_get_op_array_extension_handles()

ZEND_API int zend_get_op_array_extension_handles ( const char * module_name,
int handles )

See zend_get_op_array_extension_handle for important usage information.

Definition at line 298 of file zend_extensions.c.

◆ zend_get_resource_handle()

ZEND_API int zend_get_resource_handle ( const char * module_name)

Definition at line 259 of file zend_extensions.c.

◆ zend_init_internal_run_time_cache()

ZEND_API void zend_init_internal_run_time_cache ( void )

Definition at line 325 of file zend_extensions.c.

◆ zend_internal_run_time_cache_reserved_size()

ZEND_API size_t zend_internal_run_time_cache_reserved_size ( void )

Definition at line 321 of file zend_extensions.c.

◆ zend_load_extension()

ZEND_API zend_result zend_load_extension ( const char * path)

Definition at line 29 of file zend_extensions.c.

◆ zend_load_extension_handle()

ZEND_API zend_result zend_load_extension_handle ( DL_HANDLE handle,
const char * path )

Definition at line 63 of file zend_extensions.c.

◆ zend_register_extension()

ZEND_API void zend_register_extension ( zend_extension * new_extension,
DL_HANDLE handle )

Definition at line 150 of file zend_extensions.c.

◆ zend_reset_internal_run_time_cache()

ZEND_API void zend_reset_internal_run_time_cache ( void )

Definition at line 358 of file zend_extensions.c.

◆ zend_shutdown_extensions()

void zend_shutdown_extensions ( void )

Definition at line 222 of file zend_extensions.c.

◆ zend_startup_extensions()

void zend_startup_extensions ( void )

Definition at line 216 of file zend_extensions.c.

◆ zend_startup_extensions_mechanism()

void zend_startup_extensions_mechanism ( void )

Definition at line 206 of file zend_extensions.c.

Variable Documentation

◆ zend_extension_flags

ZEND_API uint32_t zend_extension_flags
extern

Definition at line 24 of file zend_extensions.c.

◆ zend_extensions

ZEND_API zend_llist zend_extensions
extern

Definition at line 23 of file zend_extensions.c.

◆ zend_op_array_extension_handles

ZEND_API int zend_op_array_extension_handles
extern

Definition at line 25 of file zend_extensions.c.