Permalink
Browse files

Disallow static declaration of clone

  • Loading branch information...
1 parent 3eb16bc commit 7c2e02d38019efcd170ec789bd360de5637d1b84 Marcus Boerger committed Jan 23, 2004
Showing with 14 additions and 1 deletion.
  1. +6 −0 Zend/zend_API.c
  2. +6 −0 Zend/zend_compile.c
  3. +2 −1 Zend/zend_compile.h
View
@@ -1304,6 +1304,12 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
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;
+ 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);
+ }
+ }
}
return SUCCESS;
}
View
@@ -2400,6 +2400,12 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
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;
+ 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);
+ }
+ }
ce->line_end = zend_get_compiled_lineno(TSRMLS_C);
View
@@ -111,7 +111,8 @@ typedef struct _zend_brk_cont_element {
#define ZEND_ACC_IMPLICIT_PUBLIC 0x1000
#define ZEND_ACC_CTOR 0x2000
-#define ZEND_ACC_DTOR 0x4000
+#define ZEND_ACC_DTOR 0x4000
+#define ZEND_ACC_CLONE 0x8000
char *zend_visibility_string(zend_uint fn_flags);

0 comments on commit 7c2e02d

Please sign in to comment.