Minor fix to previous patch.
I remeber Markus was suggesting "class_name::method_name()" in
error message. This one does that.

--
Yasuo Ohgaki
/usr/bin/diff: conflicting specifications of output style
--- zend_compile.c.~1.226.~     Tue Mar 26 17:48:18 2002
+++ zend_compile.c      Thu Mar 28 11:24:00 2002
@@ -732,8 +732,23 @@
        op_array.return_reference = return_reference;
 
        if (is_method) {
-               if (zend_hash_add(&CG(active_class_entry)->function_table, name, 
name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == 
FAILURE) {
-                       zend_error(E_ERROR, "Cannot redeclare method %s()", name);
+               zend_class_entry *tmp;
+               void *dummy;
+               int overload = 0;
+               tmp = CG(active_class_entry)->parent;
+               while (tmp) {
+                       if (zend_hash_find(&(tmp->function_table), name, name_len+1, 
+(void **) &dummy) == SUCCESS) {
+                               overload = 1;
+                       }
+                       tmp = tmp->parent;
+               }
+               if (overload) {
+                       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 {
+                       if (zend_hash_add(&CG(active_class_entry)->function_table, 
+name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) 
+== FAILURE) {
+                               zend_error(E_ERROR, "Cannot redeclare method 
+%s::%s()", CG(active_class_entry)->name, name);
+                       }
                }
        } else {
                zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to