#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
#include <stdlib.h>
#include <stdio.h>
-
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <sys/param.h>
#define GET_DL_ERROR() DL_ERROR()
#endif
-
#endif /* defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H */
-
/* {{{ proto int dl(string extension_filename) U
Load a PHP extension at runtime */
PHP_FUNCTION(dl)
php_dl(filename, MODULE_TEMPORARY, return_value, 0 TSRMLS_CC);
EG(full_tables_cleanup) = 1;
}
-
/* }}} */
-
#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
#ifdef ZTS
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
- /*
- * some OS prepend _ to symbol names while their dynamic linker
+ /* Some OS prepend _ to symbol names while their dynamic linker
* does not do that automatically. Thus we check manually for
- * _get_module.
- */
+ * _get_module. */
- if (!get_module)
+ if (!get_module) {
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
+ }
if (!get_module) {
DL_UNLOAD(handle);
RETURN_FALSE;
}
module_entry = get_module();
- if ((module_entry->zend_debug != ZEND_DEBUG) || (module_entry->zts != USING_ZTS)
- || (module_entry->zend_api != ZEND_MODULE_API_NO)) {
+ if ((module_entry->zend_debug != ZEND_DEBUG) ||
+ (module_entry->zts != USING_ZTS) ||
+ (module_entry->zend_api != ZEND_MODULE_API_NO)
+ ) {
/* Check for pre-4.1.0 module which has a slightly different module_entry structure :( */
struct pre_4_1_0_module_entry {
- char *name;
- zend_function_entry *functions;
- int (*module_startup_func)(INIT_FUNC_ARGS);
- int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- int (*request_startup_func)(INIT_FUNC_ARGS);
- int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
- int (*global_startup_func)(void);
- int (*global_shutdown_func)(void);
- int globals_id;
- int module_started;
- unsigned char type;
- void *handle;
- int module_number;
- unsigned char zend_debug;
- unsigned char zts;
- unsigned int zend_api;
+ char *name;
+ zend_function_entry *functions;
+ int (*module_startup_func)(INIT_FUNC_ARGS);
+ int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
+ int (*request_startup_func)(INIT_FUNC_ARGS);
+ int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
+ void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
+ int (*global_startup_func)(void);
+ int (*global_shutdown_func)(void);
+ int globals_id;
+ int module_started;
+ unsigned char type;
+ void *handle;
+ int module_number;
+ unsigned char zend_debug;
+ unsigned char zts;
+ unsigned int zend_api;
};
const char *name;
if ((((struct pre_4_1_0_module_entry *)module_entry)->zend_api > 20000000) &&
(((struct pre_4_1_0_module_entry *)module_entry)->zend_api < 20010901)
) {
- name = ((struct pre_4_1_0_module_entry *)module_entry)->name;
- zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api;
- zend_debug = ((struct pre_4_1_0_module_entry *)module_entry)->zend_debug;
- zts = ((struct pre_4_1_0_module_entry *)module_entry)->zts;
- } else {
- name = module_entry->name;
- zend_api = module_entry->zend_api;
- zend_debug = module_entry->zend_debug;
- zts = module_entry->zts;
+ name = ((struct pre_4_1_0_module_entry *)module_entry)->name;
+ zend_api = ((struct pre_4_1_0_module_entry *)module_entry)->zend_api;
+ zend_debug = ((struct pre_4_1_0_module_entry *)module_entry)->zend_debug;
+ zts = ((struct pre_4_1_0_module_entry *)module_entry)->zts;
+ } else {
+ name = module_entry->name;
+ zend_api = module_entry->zend_api;
+ zend_debug = module_entry->zend_debug;
+ zts = module_entry->zts;
}
php_error_docref(NULL TSRMLS_CC, error_type,
- "%s: Unable to initialize module\n"
- "Module compiled with module API=%d, debug=%d, thread-safety=%d\n"
- "PHP compiled with module API=%d, debug=%d, thread-safety=%d\n"
- "These options need to match\n",
- name, zend_api, zend_debug, zts,
- ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS);
+ "%s: Unable to initialize module\n"
+ "Module compiled with module API=%d, debug=%d, thread-safety=%d\n"
+ "PHP compiled with module API=%d, debug=%d, thread-safety=%d\n"
+ "These options need to match\n",
+ name, zend_api, zend_debug, zts,
+ ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS);
DL_UNLOAD(handle);
RETURN_FALSE;
}