summaryrefslogtreecommitdiff
path: root/ext/standard/dl.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-06-17 09:39:23 +0000
committerDmitry Stogov <dmitry@php.net>2005-06-17 09:39:23 +0000
commitf47c78487bda814ccb1de09fe44fe9a6b4082c30 (patch)
treeb6abddf041fb917f5545741ea8928be9ebb66985 /ext/standard/dl.c
parentc0c7a9f0101f5488cbf861390f5a89feaebcc94a (diff)
downloadphp-git-f47c78487bda814ccb1de09fe44fe9a6b4082c30.tar.gz
Improved PHP extension loading mechanism with support for module dependencies and conflicts
Diffstat (limited to 'ext/standard/dl.c')
-rw-r--r--ext/standard/dl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 8d311aa2df..5d83fc7451 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -54,7 +54,7 @@
Load a PHP extension at runtime */
PHP_FUNCTION(dl)
{
- pval **file;
+ zval **file;
/* obtain arguments */
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &file) == FAILURE) {
@@ -99,7 +99,7 @@ PHP_FUNCTION(dl)
/* {{{ php_dl
*/
-void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
+void php_dl(zval *file, int type, zval *return_value TSRMLS_DC)
{
void *handle;
char *libpath;
@@ -224,14 +224,18 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
RETURN_FALSE;
}
+ if (type == MODULE_TEMPORARY && zend_startup_module(module_entry TSRMLS_CC) == FAILURE) {
+ DL_UNLOAD(handle);
+ RETURN_FALSE;
+ }
+
if ((type == MODULE_TEMPORARY) && module_entry->request_startup_func) {
- if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC)) {
+ if (module_entry->request_startup_func(type, module_entry->module_number TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, error_type, "Unable to initialize module '%s'", module_entry->name);
DL_UNLOAD(handle);
RETURN_FALSE;
}
}
-
RETURN_TRUE;
}
/* }}} */
@@ -243,7 +247,7 @@ PHP_MINFO_FUNCTION(dl)
#else
-void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
+void php_dl(zval *file, int type, zval *return_value TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", Z_STRVAL_P(file));
RETURN_FALSE;