]> granicus.if.org Git - php/commitdiff
Allow module to proclaim compatibility with any Zend version
authorStanislav Malyshev <stas@php.net>
Sun, 29 Oct 2000 16:25:16 +0000 (16:25 +0000)
committerStanislav Malyshev <stas@php.net>
Sun, 29 Oct 2000 16:25:16 +0000 (16:25 +0000)
Zend/zend_extensions.c
Zend/zend_extensions.h

index 794728adb5cbde47e2a45915057bc72923b95134..06d4d5c7381bac94655e1499cfd2bd0e84de7801 100644 (file)
@@ -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",
@@ -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,
index c39ac27937ccde6d0004f1f5ec8a73a889b36584..b594788809c25506e0127ef68e77e11fedae3d3e 100644 (file)
@@ -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;
@@ -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;
@@ -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;