From aea24b2a79597ffd9c6e89bc199113a548a383be Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Fri, 26 Mar 2004 20:05:35 +0000 Subject: [PATCH] Force destructors to have empty signatures --- NEWS | 1 + Zend/zend_API.c | 4 ++++ Zend/zend_compile.c | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 79ca3d6073..9e11a10c6e 100644 --- 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) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 096a99bcf2..ccc25cf3a3 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -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; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a5348d5082..2f3cfcd24c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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; -- 2.40.0