]> granicus.if.org Git - php/commitdiff
- MFH zend_is_callable_ex() returns zend_class_entry* if available
authorMarcus Boerger <helly@php.net>
Tue, 25 Oct 2005 23:19:59 +0000 (23:19 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 25 Oct 2005 23:19:59 +0000 (23:19 +0000)
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_extensions.h

index 5e7c4fc9daba93f2ad16f91d90f6a41a9602a045..584d7a1ec3df0b199ad1a4721f13df6b0a5b3a71 100644 (file)
@@ -1945,23 +1945,28 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
        return 1;
 }
 
-ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
+ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
 {
        char *lcname;
        zend_bool retval = 0; 
        int callable_name_len_local;
+       zend_class_entry *ce_local;
        zend_function *fptr_local;
        zval **zobj_ptr_local;
 
        if (callable_name_len == NULL) {
                callable_name_len = &callable_name_len_local;
        }
+       if (ce_ptr == NULL) {
+               ce_ptr = &ce_local;
+       }
        if (fptr_ptr == NULL) {
                fptr_ptr = &fptr_local;
        }
        if (zobj_ptr_ptr == NULL) {
                zobj_ptr_ptr = &zobj_ptr_local;
        }
+       *ce_ptr = NULL;
        *fptr_ptr = NULL;
        *zobj_ptr_ptr = NULL;
 
@@ -1984,9 +1989,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
 
                case IS_ARRAY:
                        {
+                               zend_class_entry *ce = NULL, **pce;
                                zval **method;
                                zval **obj;
-                               zend_class_entry *ce = NULL, **pce;
                                
                                if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
                                        zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
@@ -2007,8 +2012,10 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                                        memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
                                                }
 
-                                               if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
+                                               if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
+                                                       *ce_ptr = ce;
                                                        return 1;
+                                               }
 
                                                lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
 
@@ -2038,8 +2045,10 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                                        memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
                                                }
 
-                                               if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
+                                               if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
+                                                       *ce_ptr = ce;
                                                        return 1;
+                                               }
                                        }
 
                                        if (ce) {
@@ -2077,6 +2086,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
                                        *callable_name = estrndup("Array", sizeof("Array")-1);
                                        *callable_name_len = sizeof("Array") - 1;
                                }
+                               *ce_ptr = ce;
                        }
                        break;
 
@@ -2101,7 +2111,7 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
 {
        TSRMLS_FETCH();
 
-       return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
+       return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC);
 }
 
 
@@ -2112,7 +2122,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRML
        zend_class_entry **pce;
        int class_name_len;
 
-       if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL TSRMLS_CC)) {
+       if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC)) {
                return 1;
        }
        switch (Z_TYPE_P(callable)) {
index 6ac16441ba83e24217e671d68ff7f30dc62fb86a..bf8c90aed908f853f648e64d35604352fab980ee 100644 (file)
@@ -198,7 +198,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
 #define IS_CALLABLE_CHECK_NO_ACCESS   (1<<1)
 #define IS_CALLABLE_CHECK_IS_STATIC   (1<<2)
 
-ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
+ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
 ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
 ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
 ZEND_API char *zend_get_module_version(char *module_name);
index fbe9eee165a1032215e3794684c5af0818f252ab..5c37951061717e15fab22f83bfe5949d18cdc8ce 100644 (file)
@@ -27,7 +27,7 @@
 /* The first number is the engine version and the rest is the date.
  * This way engine 2 API no. is always greater than engine 1 API no..
  */
-#define ZEND_EXTENSION_API_NO  220050920
+#define ZEND_EXTENSION_API_NO  220051025
 
 typedef struct _zend_extension_version_info {
        int zend_extension_api_no;