]> granicus.if.org Git - php/commitdiff
Force destructors to have empty signatures
authorMarcus Boerger <helly@php.net>
Fri, 26 Mar 2004 20:05:35 +0000 (20:05 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 26 Mar 2004 20:05:35 +0000 (20:05 +0000)
NEWS
Zend/zend_API.c
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 79ca3d60736b2cac5cf81abf9b96c818f8f0b825..9e11a10c6ef7bf5ee20eac5cc8aa972c3d9c0720 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ????? 2004, PHP 5 Release Candidate 2
+- Force destructors to have empty signatures. (Marcus)
 - Stopped file uploads from throwing E_WARNINGs and E_NOTICEs which can not be
   hidden from within scripts (and a result value in the $_FILES global can be
   used to see the real failure anyway). (Derick)
index 096a99bcf20a5de1cb8355611df260c52d551e1d..ccc25cf3a3733e2db421b977540a83d7f159b6c8 100644 (file)
@@ -1275,6 +1275,10 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
                                ctor = reg_function;
                        } else if (!strcmp(ptr->fname, ZEND_DESTRUCTOR_FUNC_NAME)) {
                                dtor = reg_function;
+                               if (internal_function->num_args) {
+                                       zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name, ptr->fname);
+                               }
+
                        } else if (!strcmp(ptr->fname, ZEND_CLONE_FUNC_NAME)) {
                                clone = reg_function;
                        }
index a5348d5082a21fbcbf216c05e557fcaed6eefd67..2f3cfcd24cfa1ec333d15a77349988cc004800fb 100644 (file)
@@ -1114,6 +1114,10 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
        zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
        zend_arg_info *cur_arg_info;
 
+       if (CG(active_class_entry) && CG(active_class_entry)->destructor == (zend_function *) CG(active_op_array))
+       {
+               zend_error(E_COMPILE_ERROR, "Destuctor %s::%s() cannot take arguments", CG(active_class_entry)->name, CG(active_op_array)->function_name);
+       }
        CG(active_op_array)->num_args++;
        opline->opcode = op;
        opline->result = *var;