Skip to content

Commit

Permalink
Allow module to proclaim compatibility with any Zend version
Browse files Browse the repository at this point in the history
  • Loading branch information
smalyshev committed Oct 29, 2000
1 parent 009e5df commit ca07586
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
21 changes: 12 additions & 9 deletions Zend/zend_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,19 @@ int zend_load_extension(char *path)
return FAILURE;
}

if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
fprintf(stderr, "%s requires Zend Engine API version %d\n"

/* allow extension to proclaim compatibility with any Zend version */
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)) {
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
fprintf(stderr, "%s requires Zend Engine API version %d\n"
"The installed Zend Engine API version is %d\n\n",
new_extension->name,
extension_version_info->zend_extension_api_no,
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. */
fprintf(stderr, "%s designed to be used with the Zend Engine API %d is outdated\n"
DL_UNLOAD(handle);
return FAILURE;
} else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
fprintf(stderr, "%s designed to be used with the Zend Engine API %d is outdated\ n"
"It requires a more recent version of the Zend Engine\n"
"The installed Zend Engine API version is %d\n"
"Contact %s at %s for a later version of this module.\n\n",
Expand All @@ -83,8 +85,9 @@ int zend_load_extension(char *path)
ZEND_EXTENSION_API_NO,
new_extension->author,
new_extension->URL);
DL_UNLOAD(handle);
return FAILURE;
DL_UNLOAD(handle);
return FAILURE;
}
} else if (ZTS_V!=extension_version_info->thread_safe) {
fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
new_extension->name,
Expand Down
5 changes: 3 additions & 2 deletions Zend/zend_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "zend_compile.h"

#define ZEND_EXTENSION_API_NO 20001002
#define ZEND_EXTENSION_API_NO 20001002

typedef struct _zend_extension_version_info {
int zend_extension_api_no;
Expand Down Expand Up @@ -58,7 +58,7 @@ struct _zend_extension {
void (*op_array_ctor)(zend_op_array *op_array);
void (*op_array_dtor)(zend_op_array *op_array);

void *reserved1;
int (*api_no_check)(int api_no);
void *reserved2;
void *reserved3;
void *reserved4;
Expand All @@ -82,6 +82,7 @@ ZEND_API void zend_extension_dispatch_message(int message, void *arg);
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_VERSION, ZTS_V, ZEND_DEBUG }

#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


ZEND_API extern zend_llist zend_extensions;
Expand Down

0 comments on commit ca07586

Please sign in to comment.