1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2019-01-30 17:23:29 +08:00
|
|
|
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:16:21 +08:00
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
2015-01-03 17:22:58 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2001-12-11 23:16:21 +08:00
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
1999-07-16 22:58:16 +08:00
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2018-11-01 23:20:07 +08:00
|
|
|
| Authors: Andi Gutmans <andi@php.net> |
|
|
|
|
| Zeev Suraski <zeev@php.net> |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "zend_extensions.h"
|
2020-07-17 07:31:10 +08:00
|
|
|
#include "zend_system_id.h"
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
ZEND_API zend_llist zend_extensions;
|
2015-09-25 16:50:38 +08:00
|
|
|
ZEND_API uint32_t zend_extension_flags = 0;
|
2018-10-17 20:52:50 +08:00
|
|
|
ZEND_API int zend_op_array_extension_handles = 0;
|
2000-04-28 23:52:02 +08:00
|
|
|
static int last_resource_number;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
zend_result zend_load_extension(const char *path)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
#if ZEND_EXTENSIONS_SUPPORT
|
|
|
|
DL_HANDLE handle;
|
|
|
|
|
|
|
|
handle = DL_LOAD(path);
|
|
|
|
if (!handle) {
|
2000-02-11 23:59:30 +08:00
|
|
|
#ifndef ZEND_WIN32
|
2002-08-24 06:07:59 +08:00
|
|
|
fprintf(stderr, "Failed loading %s: %s\n", path, DL_ERROR());
|
1999-06-09 03:37:40 +08:00
|
|
|
#else
|
|
|
|
fprintf(stderr, "Failed loading %s\n", path);
|
2015-07-05 00:55:22 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
|
|
|
fflush(stderr);
|
1999-06-09 03:37:40 +08:00
|
|
|
#endif
|
1999-04-08 02:10:10 +08:00
|
|
|
return FAILURE;
|
|
|
|
}
|
Check linker compatibility directly from HMODULE
Checking the linker compatibility with extranous `ImageLoad()` calls is
possible, but unnecessary, since the modules are either already loaded
or loaded shortly afterwards, so that we can get the required
information directly from the module handles. And actually, doing
`ImageLoad()` as well as `LoadLibrary()` leaves a tiny room for a race
condition, because both functions will lookup the module in the search
path, so there is no *guarantee* that both are dealing with the same
module. Dropping the `ImageLoad()` calls also has the advantage to no
longer face the issue reported in bug #79557. A very minor additional
advantage is that we no longer have to link against Imagehlp.dll.
Furthermore, there is no need to check for CRT compatibility multiple
times, so we can simplify the signature of `php_win32_crt_compatible`,
and at the same time clean up main.c a bit.
These changes require to change the signature of the exported
`php_win32_image_compatible` and `php_win32_crt_compatible` functions,
which now expect a `HMODULE` and nothing, respectively, instead of the
module name.
2020-08-05 14:59:41 +08:00
|
|
|
#ifdef ZEND_WIN32
|
|
|
|
char *err;
|
|
|
|
if (!php_win32_image_compatible(handle, &err)) {
|
|
|
|
zend_error(E_CORE_WARNING, err);
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
#endif
|
2017-07-13 20:27:19 +08:00
|
|
|
return zend_load_extension_handle(handle, path);
|
|
|
|
#else
|
|
|
|
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
|
|
|
#ifdef ZEND_WIN32
|
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
|
|
|
return FAILURE;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
zend_result zend_load_extension_handle(DL_HANDLE handle, const char *path)
|
2017-07-13 20:27:19 +08:00
|
|
|
{
|
|
|
|
#if ZEND_EXTENSIONS_SUPPORT
|
|
|
|
zend_extension *new_extension;
|
|
|
|
zend_extension_version_info *extension_version_info;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
|
2003-04-19 01:55:45 +08:00
|
|
|
if (!extension_version_info) {
|
|
|
|
extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "_extension_version_info");
|
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
|
2003-04-19 01:55:45 +08:00
|
|
|
if (!new_extension) {
|
|
|
|
new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "_zend_extension_entry");
|
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
if (!extension_version_info || !new_extension) {
|
1999-06-09 03:37:40 +08:00
|
|
|
fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
|
2010-01-25 22:47:19 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2010-01-25 22:47:19 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
2003-03-17 22:41:04 +08:00
|
|
|
DL_UNLOAD(handle);
|
1999-04-08 02:10:10 +08:00
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
2000-10-30 00:25:16 +08:00
|
|
|
/* allow extension to proclaim compatibility with any Zend version */
|
2001-04-28 02:51:56 +08:00
|
|
|
if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
|
2000-10-30 00:25:16 +08:00
|
|
|
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
|
2001-08-16 02:06:06 +08:00
|
|
|
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
|
|
|
"The Zend Engine API version %d which is installed, is outdated.\n\n",
|
1999-04-08 02:10:10 +08:00
|
|
|
new_extension->name,
|
2000-06-23 02:50:55 +08:00
|
|
|
extension_version_info->zend_extension_api_no,
|
1999-04-08 02:10:10 +08:00
|
|
|
ZEND_EXTENSION_API_NO);
|
2010-01-25 22:47:19 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2010-01-25 22:47:19 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
2000-10-30 00:25:16 +08:00
|
|
|
DL_UNLOAD(handle);
|
|
|
|
return FAILURE;
|
|
|
|
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
2001-08-16 02:06:06 +08:00
|
|
|
fprintf(stderr, "%s requires Zend Engine API version %d.\n"
|
|
|
|
"The Zend Engine API version %d which is installed, is newer.\n"
|
|
|
|
"Contact %s at %s for a later version of %s.\n\n",
|
1999-04-08 02:10:10 +08:00
|
|
|
new_extension->name,
|
|
|
|
extension_version_info->zend_extension_api_no,
|
|
|
|
ZEND_EXTENSION_API_NO,
|
|
|
|
new_extension->author,
|
2001-08-16 02:06:06 +08:00
|
|
|
new_extension->URL,
|
|
|
|
new_extension->name);
|
2010-01-25 22:47:19 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2010-01-25 22:47:19 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
2000-10-30 00:25:16 +08:00
|
|
|
DL_UNLOAD(handle);
|
|
|
|
return FAILURE;
|
2006-05-10 07:53:23 +08:00
|
|
|
}
|
2009-04-08 20:19:01 +08:00
|
|
|
} else if (strcmp(ZEND_EXTENSION_BUILD_ID, extension_version_info->build_id) &&
|
|
|
|
(!new_extension->build_id_check || new_extension->build_id_check(ZEND_EXTENSION_BUILD_ID) != SUCCESS)) {
|
2009-04-08 21:26:35 +08:00
|
|
|
fprintf(stderr, "Cannot load %s - it was built with configuration %s, whereas running engine is %s\n",
|
2009-01-17 10:05:13 +08:00
|
|
|
new_extension->name, extension_version_info->build_id, ZEND_EXTENSION_BUILD_ID);
|
2010-01-25 22:47:19 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2014-08-28 15:13:57 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
|
|
|
DL_UNLOAD(handle);
|
|
|
|
return FAILURE;
|
|
|
|
} else if (zend_get_extension(new_extension->name)) {
|
2014-08-28 17:05:21 +08:00
|
|
|
fprintf(stderr, "Cannot load %s - it was already loaded\n", new_extension->name);
|
2014-08-28 15:13:57 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2010-01-25 22:47:19 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
1999-04-27 19:00:59 +08:00
|
|
|
DL_UNLOAD(handle);
|
|
|
|
return FAILURE;
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
zend_register_extension(new_extension, handle);
|
|
|
|
return SUCCESS;
|
2000-03-30 03:26:34 +08:00
|
|
|
#else
|
|
|
|
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
2010-01-25 22:47:19 +08:00
|
|
|
/* See http://support.microsoft.com/kb/190351 */
|
2015-07-05 00:55:22 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2010-01-25 22:47:19 +08:00
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
2000-03-30 03:26:34 +08:00
|
|
|
return FAILURE;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
void zend_register_extension(zend_extension *new_extension, DL_HANDLE handle)
|
2000-03-30 03:26:34 +08:00
|
|
|
{
|
2000-04-15 23:32:32 +08:00
|
|
|
#if ZEND_EXTENSIONS_SUPPORT
|
2000-03-30 03:26:34 +08:00
|
|
|
zend_extension extension;
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
extension = *new_extension;
|
|
|
|
extension.handle = handle;
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
|
2000-04-29 18:20:40 +08:00
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
zend_llist_add_element(&zend_extensions, &extension);
|
|
|
|
|
2015-09-25 16:50:38 +08:00
|
|
|
if (extension.op_array_ctor) {
|
|
|
|
zend_extension_flags |= ZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR;
|
|
|
|
}
|
|
|
|
if (extension.op_array_dtor) {
|
|
|
|
zend_extension_flags |= ZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR;
|
|
|
|
}
|
|
|
|
if (extension.op_array_handler) {
|
|
|
|
zend_extension_flags |= ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER;
|
|
|
|
}
|
|
|
|
if (extension.op_array_persist_calc) {
|
|
|
|
zend_extension_flags |= ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC;
|
|
|
|
}
|
|
|
|
if (extension.op_array_persist) {
|
|
|
|
zend_extension_flags |= ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST;
|
|
|
|
}
|
1999-06-09 03:37:40 +08:00
|
|
|
/*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
|
2000-04-15 23:32:32 +08:00
|
|
|
#endif
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
2000-03-30 03:26:34 +08:00
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_extension_shutdown(zend_extension *extension)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
#if ZEND_EXTENSIONS_SUPPORT
|
|
|
|
if (extension->shutdown) {
|
|
|
|
extension->shutdown(extension);
|
|
|
|
}
|
1999-04-18 23:11:52 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-08-28 21:41:27 +08:00
|
|
|
/* int return due to zend linked list API */
|
2000-10-19 04:15:53 +08:00
|
|
|
static int zend_extension_startup(zend_extension *extension)
|
2000-09-26 02:10:45 +08:00
|
|
|
{
|
2000-10-14 08:16:46 +08:00
|
|
|
#if ZEND_EXTENSIONS_SUPPORT
|
2000-09-26 02:10:45 +08:00
|
|
|
if (extension->startup) {
|
|
|
|
if (extension->startup(extension)!=SUCCESS) {
|
2000-10-19 04:15:53 +08:00
|
|
|
return 1;
|
2000-09-26 02:10:45 +08:00
|
|
|
}
|
2001-02-13 21:53:42 +08:00
|
|
|
zend_append_version_info(extension);
|
2000-09-26 02:10:45 +08:00
|
|
|
}
|
2000-10-14 08:16:46 +08:00
|
|
|
#endif
|
2000-10-19 04:15:53 +08:00
|
|
|
return 0;
|
2000-09-26 02:10:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-24 23:14:47 +08:00
|
|
|
void zend_startup_extensions_mechanism(void)
|
2000-04-28 23:52:02 +08:00
|
|
|
{
|
2000-09-26 02:10:45 +08:00
|
|
|
/* Startup extensions mechanism */
|
2000-04-28 23:52:02 +08:00
|
|
|
zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
|
2018-10-17 20:52:50 +08:00
|
|
|
zend_op_array_extension_handles = 0;
|
2000-04-28 23:52:02 +08:00
|
|
|
last_resource_number = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-24 23:14:47 +08:00
|
|
|
void zend_startup_extensions(void)
|
2000-09-26 02:10:45 +08:00
|
|
|
{
|
2000-10-19 04:15:53 +08:00
|
|
|
zend_llist_apply_with_del(&zend_extensions, (int (*)(void *)) zend_extension_startup);
|
2000-09-26 02:10:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
void zend_shutdown_extensions(void)
|
1999-04-18 23:11:52 +08:00
|
|
|
{
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_shutdown);
|
1999-04-18 23:11:52 +08:00
|
|
|
zend_llist_destroy(&zend_extensions);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void zend_extension_dtor(zend_extension *extension)
|
|
|
|
{
|
2000-09-26 02:10:45 +08:00
|
|
|
#if ZEND_EXTENSIONS_SUPPORT && !ZEND_DEBUG
|
2014-09-09 04:50:44 +08:00
|
|
|
if (extension->handle && !getenv("ZEND_DONT_UNLOAD_MODULES")) {
|
2000-03-30 03:26:34 +08:00
|
|
|
DL_UNLOAD(extension->handle);
|
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
static void zend_extension_message_dispatcher(const zend_extension *extension, int num_args, va_list args)
|
2000-04-29 18:20:40 +08:00
|
|
|
{
|
|
|
|
int message;
|
|
|
|
void *arg;
|
|
|
|
|
2000-04-29 18:34:03 +08:00
|
|
|
if (!extension->message_handler || num_args!=2) {
|
2000-04-29 18:20:40 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
message = va_arg(args, int);
|
|
|
|
arg = va_arg(args, void *);
|
|
|
|
extension->message_handler(message, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-14 06:06:14 +08:00
|
|
|
ZEND_API void zend_extension_dispatch_message(int message, void *arg)
|
2000-04-29 18:20:40 +08:00
|
|
|
{
|
2014-12-14 06:06:14 +08:00
|
|
|
zend_llist_apply_with_arguments(&zend_extensions, (llist_apply_with_args_func_t) zend_extension_message_dispatcher, 2, message, arg);
|
2000-04-29 18:20:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-17 07:31:10 +08:00
|
|
|
ZEND_API int zend_get_resource_handle(const char *module_name)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-25 22:20:52 +08:00
|
|
|
if (last_resource_number<ZEND_MAX_RESERVED_RESOURCES) {
|
2020-07-17 07:31:10 +08:00
|
|
|
zend_add_system_entropy(module_name, "zend_get_resource_handle", &last_resource_number, sizeof(int));
|
2000-04-25 22:20:52 +08:00
|
|
|
return last_resource_number++;
|
1999-04-08 02:10:10 +08:00
|
|
|
} else {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2000-11-08 22:25:42 +08:00
|
|
|
|
2020-07-17 07:31:10 +08:00
|
|
|
ZEND_API int zend_get_op_array_extension_handle(const char *module_name)
|
2018-10-17 20:52:50 +08:00
|
|
|
{
|
2022-02-12 08:26:23 +08:00
|
|
|
int handle = zend_op_array_extension_handles++;
|
2020-07-17 07:31:10 +08:00
|
|
|
zend_add_system_entropy(module_name, "zend_get_op_array_extension_handle", &zend_op_array_extension_handles, sizeof(int));
|
2022-02-12 08:26:23 +08:00
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZEND_API int zend_get_op_array_extension_handles(const char *module_name, int handles)
|
|
|
|
{
|
|
|
|
int handle = zend_op_array_extension_handles;
|
|
|
|
zend_op_array_extension_handles += handles;
|
|
|
|
zend_add_system_entropy(module_name, "zend_get_op_array_extension_handle", &zend_op_array_extension_handles, sizeof(int));
|
|
|
|
return handle;
|
2018-10-17 20:52:50 +08:00
|
|
|
}
|
2000-11-08 22:25:42 +08:00
|
|
|
|
2008-08-13 01:20:25 +08:00
|
|
|
ZEND_API zend_extension *zend_get_extension(const char *extension_name)
|
2000-11-08 22:25:42 +08:00
|
|
|
{
|
|
|
|
zend_llist_element *element;
|
|
|
|
|
|
|
|
for (element = zend_extensions.head; element; element = element->next) {
|
|
|
|
zend_extension *extension = (zend_extension *) element->data;
|
|
|
|
|
|
|
|
if (!strcmp(extension->name, extension_name)) {
|
|
|
|
return extension;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-07-18 19:16:34 +08:00
|
|
|
|
2015-09-25 16:50:38 +08:00
|
|
|
typedef struct _zend_extension_persist_data {
|
|
|
|
zend_op_array *op_array;
|
|
|
|
size_t size;
|
|
|
|
char *mem;
|
|
|
|
} zend_extension_persist_data;
|
|
|
|
|
|
|
|
static void zend_extension_op_array_persist_calc_handler(zend_extension *extension, zend_extension_persist_data *data)
|
|
|
|
{
|
|
|
|
if (extension->op_array_persist_calc) {
|
|
|
|
data->size += extension->op_array_persist_calc(data->op_array);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void zend_extension_op_array_persist_handler(zend_extension *extension, zend_extension_persist_data *data)
|
|
|
|
{
|
|
|
|
if (extension->op_array_persist) {
|
|
|
|
size_t size = extension->op_array_persist(data->op_array, data->mem);
|
|
|
|
if (size) {
|
|
|
|
data->mem = (void*)((char*)data->mem + size);
|
|
|
|
data->size += size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array)
|
|
|
|
{
|
|
|
|
if (zend_extension_flags & ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC) {
|
|
|
|
zend_extension_persist_data data;
|
|
|
|
|
|
|
|
data.op_array = op_array;
|
|
|
|
data.size = 0;
|
|
|
|
data.mem = NULL;
|
|
|
|
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_persist_calc_handler, &data);
|
|
|
|
return data.size;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZEND_API size_t zend_extensions_op_array_persist(zend_op_array *op_array, void *mem)
|
|
|
|
{
|
|
|
|
if (zend_extension_flags & ZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST) {
|
|
|
|
zend_extension_persist_data data;
|
|
|
|
|
|
|
|
data.op_array = op_array;
|
|
|
|
data.size = 0;
|
|
|
|
data.mem = mem;
|
|
|
|
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_persist_handler, &data);
|
|
|
|
return data.size;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|