]> granicus.if.org Git - php/commitdiff
Simplify detection of methods that must be called dynamic (with object)
authorMarcus Boerger <helly@php.net>
Fri, 23 Jan 2004 22:04:42 +0000 (22:04 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 23 Jan 2004 22:04:42 +0000 (22:04 +0000)
Zend/zend_API.c
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_execute.c
Zend/zend_execute_API.c

index 2e7b897e2b8e6a80f46dbdca925316f4462df7a7..ec6fb918dba4a54f8170ac66114c0820a068bed4 100644 (file)
@@ -1293,19 +1293,19 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                scope->destructor = dtor;
                scope->clone = clone;
                if (ctor) {
-                       ctor->common.fn_flags |= ZEND_ACC_CTOR;
+                       ctor->common.fn_flags |= ZEND_ACC_CTOR|ZEND_ACC_DYNAMIC;
                        if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
                                zend_error(error_type, "Constructor %s::%s cannot be static", ctor->common.scope->name, ctor->common.function_name);
                        }
                }
                if (dtor) {
-                       dtor->common.fn_flags |= ZEND_ACC_DTOR;
+                       dtor->common.fn_flags |= ZEND_ACC_DTOR|ZEND_ACC_DYNAMIC;
                        if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
                                zend_error(error_type, "Destructor %s::%s cannot be static", dtor->common.scope->name, dtor->common.function_name);
                        }
                }
                if (clone) {
-                       clone->common.fn_flags |= ZEND_ACC_CLONE;
+                       clone->common.fn_flags |= ZEND_ACC_CLONE|ZEND_ACC_DYNAMIC;
                        if (clone->common.fn_flags & ZEND_ACC_STATIC) {
                                zend_error(error_type, "Constructor %s::%s cannot be static", clone->common.scope->name, clone->common.function_name);
                        }
index 1c9d8d2570db392ebc3e2d7babc9c5b8b94e76ee..fe98fc24f429eb54e928b577b184cbf57363ea6a 100644 (file)
@@ -2389,19 +2389,19 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
        do_inherit_parent_constructor(ce);
 
        if (ce->constructor) {
-               ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
+               ce->constructor->common.fn_flags |= ZEND_ACC_CTOR|ZEND_ACC_DYNAMIC;
                if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
                        zend_error(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", ce->name, ce->constructor->common.function_name);
                }
        }
        if (ce->destructor) {
-               ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
+               ce->destructor->common.fn_flags |= ZEND_ACC_DTOR|ZEND_ACC_DYNAMIC;
                if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) {
                        zend_error(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", ce->name, ce->destructor->common.function_name);
                }
        }
        if (ce->clone) {
-               ce->clone->common.fn_flags |= ZEND_ACC_CLONE;
+               ce->clone->common.fn_flags |= ZEND_ACC_CLONE|ZEND_ACC_DYNAMIC;
                if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) {
                        zend_error(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", ce->name, ce->clone->common.function_name);
                }
index 787d1e1cb07106ed2447cbc93f94c61873f90624..70ad15f6b808b29007360a397a6c714cd57040bb 100644 (file)
@@ -101,6 +101,8 @@ typedef struct _zend_brk_cont_element {
 #define ZEND_ACC_ABSTRACT_CLASS        0x10
 #define ZEND_ACC_FINAL_CLASS   0x20
 
+#define ZEND_ACC_DYNAMIC       0x80
+
 /* The order of those must be kept - public < protected < private */
 #define ZEND_ACC_PUBLIC                0x100
 #define ZEND_ACC_PROTECTED     0x200
index e3f19478e3241a4675d22edc567cf9dadc024dad..fad2ac26b6727765b5b6f50889eacfbb9a3fc799 100644 (file)
@@ -2520,7 +2520,7 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
        if (EX(function_state).function->common.scope) {
                if (!EG(This) && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
                        int severity;
-                       if (EX(function_state).function->common.fn_flags & (ZEND_ACC_CTOR|ZEND_ACC_DTOR|ZEND_ACC_CLONE)) {
+                       if (EX(function_state).function->common.fn_flags & ZEND_ACC_DYNAMIC) {
                                severity = E_ERROR;
                        } else {
                                severity = E_STRICT;
index 84844992e0822c46834ffd592ba28e62b82ff1d9..c526cd9525b5817dccdbda9635b0df327dbddba4 100644 (file)
@@ -718,7 +718,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
                EG(This) = NULL;
                if (calling_scope && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
                        int severity;
-                       if (EX(function_state).function->common.fn_flags & (ZEND_ACC_CTOR|ZEND_ACC_DTOR|ZEND_ACC_CLONE)) {
+                       if (EX(function_state).function->common.fn_flags & ZEND_ACC_DYNAMIC) {
                                severity = E_ERROR;
                        } else {
                                severity = E_STRICT;