Permalink
Browse files

Simplify detection of methods that must be called dynamic (with object)

  • Loading branch information...
1 parent 4c0b1fd commit 6020ffd007d71d8cf4f08677cead48b016c9f679 Marcus Boerger committed Jan 23, 2004
Showing with 10 additions and 8 deletions.
  1. +3 −3 Zend/zend_API.c
  2. +3 −3 Zend/zend_compile.c
  3. +2 −0 Zend/zend_compile.h
  4. +1 −1 Zend/zend_execute.c
  5. +1 −1 Zend/zend_execute_API.c
View
@@ -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);
}
View
@@ -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);
}
View
@@ -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
View
@@ -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;
View
@@ -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;

0 comments on commit 6020ffd

Please sign in to comment.