]> granicus.if.org Git - php/commitdiff
Disallow static declaration of clone
authorMarcus Boerger <helly@php.net>
Fri, 23 Jan 2004 20:52:39 +0000 (20:52 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 23 Jan 2004 20:52:39 +0000 (20:52 +0000)
Zend/zend_API.c
Zend/zend_compile.c
Zend/zend_compile.h

index 277421cee1a3fccdb9584e5d92df132b62af1bf5..2e7b897e2b8e6a80f46dbdca925316f4462df7a7 100644 (file)
@@ -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;
 }
index 364df789c0bf33322e7ea8a1546423e53eabc68a..1c9d8d2570db392ebc3e2d7babc9c5b8b94e76ee 100644 (file)
@@ -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);
 
index e9afc1fe6fb67f26c8875e58300a0d757ca2d17f..787d1e1cb07106ed2447cbc93f94c61873f90624 100644 (file)
@@ -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);