mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Return a success value from the startup function, so we can unload immediately
if it fails.
This commit is contained in:
parent
84e9ea1726
commit
b7c30c1bdf
2 changed files with 8 additions and 2 deletions
|
@ -63,6 +63,7 @@ int zend_load_extension(char *path)
|
|||
extension_version_info->required_zend_version,
|
||||
ZEND_VERSION,
|
||||
ZEND_EXTENSION_API_NO);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
|
||||
/* we may be able to allow for downwards compatability in some harmless cases. */
|
||||
|
@ -73,17 +74,22 @@ int zend_load_extension(char *path)
|
|||
ZEND_EXTENSION_API_NO,
|
||||
new_extension->author,
|
||||
new_extension->URL);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
} else if (ZTS_V!=extension_version_info->thread_safe) {
|
||||
zend_printf("Cannot load %s - it %s thread safe, whereas Zend %s\n",
|
||||
new_extension->name,
|
||||
(extension_version_info->thread_safe?"is":"isn't"),
|
||||
(ZTS_V?"is":"isn't"));
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (new_extension->startup) {
|
||||
new_extension->startup(new_extension);
|
||||
if (new_extension->startup(new_extension)!=SUCCESS) {
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
extension = *new_extension;
|
||||
extension.handle = handle;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct _zend_extension {
|
|||
char *URL;
|
||||
char *copyright;
|
||||
|
||||
void (*startup)(zend_extension *extension);
|
||||
int (*startup)(zend_extension *extension);
|
||||
void (*shutdown)(zend_extension *extension);
|
||||
void (*activate)();
|
||||
void (*deactivate)();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue