cvs: ZendEngine2(PHP_5_3) / zend_compile.c

"Dmitry Stogov" <[email protected]> Wed, 08 Apr 2009 13:17:09 -0000
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1239196629@cvsserver>
dmitry		Wed Apr  8 13:17:09 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_compile.c 
  Log:
  Removed deprecated code and fixed function name in error message
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.104&r2=1.647.2.27.2.41.2.105&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.104 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.105
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.104	Fri Mar 27 02:32:56 2009
+++ ZendEngine2/zend_compile.c	Wed Apr  8 13:17:09 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.104 2009/03/27 02:32:56 lbarnaud Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.105 2009/04/08 13:17:09 dmitry Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -1197,16 +1197,7 @@
 
 	if (is_method) {
 		if (zend_hash_add(&CG(active_class_entry)->function_table, lcname, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) {
-			zend_op_array *child_op_array, *parent_op_array;
-			if (CG(active_class_entry)->parent
-					&& (zend_hash_find(&CG(active_class_entry)->function_table, name, name_len+1, (void **) &child_op_array) == SUCCESS)
-					&& (zend_hash_find(&CG(active_class_entry)->parent->function_table, name, name_len+1, (void **) &parent_op_array) == SUCCESS)
-					&& (child_op_array == parent_op_array)) {
-				zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
-			} else {
-				efree(lcname);
-				zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name);
-			}
+			zend_error(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", CG(active_class_entry)->name, name);
 		}
 
 		if (fn_flags & ZEND_ACC_ABSTRACT) {
@@ -2891,24 +2882,20 @@
 {
 	zend_function *function;
 
-	if (opline->opcode != ZEND_DECLARE_FUNCTION) {
-		zend_error(E_COMPILE_ERROR, "Internal compiler error.  Please report!");
-	}
-
 	zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void *) &function);
 	if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) {
 		int error_level = compile_time ? E_COMPILE_ERROR : E_ERROR;
-		zend_function *function;
+		zend_function *old_function;
 
-		if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &function)==SUCCESS
-			&& function->type==ZEND_USER_FUNCTION
-			&& ((zend_op_array *) function)->last>0) {
+		if (zend_hash_find(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void *) &old_function)==SUCCESS
+			&& old_function->type == ZEND_USER_FUNCTION
+			&& old_function->op_array.last > 0) {
 			zend_error(error_level, "Cannot redeclare %s() (previously declared in %s:%d)",
-						opline->op2.u.constant.value.str.val,
-						((zend_op_array *) function)->filename,
-						((zend_op_array *) function)->opcodes[0].lineno);
+						function->common.function_name,
+						old_function->op_array.filename,
+						old_function->op_array.opcodes[0].lineno);
 		} else {
-			zend_error(error_level, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
+			zend_error(error_level, "Cannot redeclare %s()", function->common.function_name);
 		}
 		return FAILURE;
 	} else {
@@ -2982,13 +2969,6 @@
 	/* Register the derived class */
 	if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, pce, sizeof(zend_class_entry *), NULL)==FAILURE) {
 		zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", ce->name);
-		ce->refcount--;
-		zend_hash_destroy(&ce->function_table);
-		zend_hash_destroy(&ce->default_properties);
-		zend_hash_destroy(&ce->properties_info);
-		zend_hash_destroy(&ce->default_static_members);
-		zend_hash_destroy(&ce->constants_table);
-		return NULL;
 	}
 	return ce;
 }
@@ -3456,8 +3436,6 @@
 {
 	zend_class_entry *ce = CG(active_class_entry);
 
-	do_inherit_parent_constructor(ce);
-
 	if (ce->constructor) {
 		ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
 		if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
@@ -3482,7 +3460,7 @@
 	if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))
 		&& ((parent_token->op_type != IS_UNUSED) || (ce->num_interfaces > 0))) {
 		zend_verify_abstract_class(ce TSRMLS_CC);
-		if (ce->parent || ce->num_interfaces) {
+		if (ce->num_interfaces) {
 			do_verify_abstract_class(TSRMLS_C);
 		}
 	}



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php