From 6020ffd007d71d8cf4f08677cead48b016c9f679 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Fri, 23 Jan 2004 22:04:42 +0000 Subject: [PATCH] Simplify detection of methods that must be called dynamic (with object) --- Zend/zend_API.c | 6 +++--- Zend/zend_compile.c | 6 +++--- Zend/zend_compile.h | 2 ++ Zend/zend_execute.c | 2 +- Zend/zend_execute_API.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 2e7b897e2b..ec6fb918db 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -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); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1c9d8d2570..fe98fc24f4 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 787d1e1cb0..70ad15f6b8 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -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 diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e3f19478e3..fad2ac26b6 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -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; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 84844992e0..c526cd9525 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -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; -- 2.50.1