From: Marcus Boerger Date: Mon, 26 May 2003 22:06:49 +0000 (+0000) Subject: - Fix handling of abstract methods. They must be inherited when inheriting X-Git-Tag: RELEASE_1_0_2~575 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d913a3bfc752609cca712aa0660dd473345c798;p=php - Fix handling of abstract methods. They must be inherited when inheriting a method. - Fix entry more (should be amed has_more). - Add a check against that bug. --- diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index a60c504d33..4467b0aa60 100755 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -131,7 +131,7 @@ PHP_MINIT_FUNCTION(spl) REGISTER_SPL_INTERFACE(spl, forward); REGISTER_SPL_INTF_FUNC(spl, forward, current); REGISTER_SPL_INTF_FUNC(spl, forward, next); - REGISTER_SPL_INTF_FUNC(spl, forward, more); + REGISTER_SPL_INTF_FUNC(spl, forward, has_more); REGISTER_SPL_INTERFACE(spl, sequence); REGISTER_SPL_INTF_FUNC(spl, sequence, rewind); diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c index 70da239906..c8a98a0cbb 100755 --- a/ext/spl/spl_functions.c +++ b/ext/spl/spl_functions.c @@ -106,6 +106,7 @@ void spl_register_implement(zend_class_entry * class_entry, zend_class_entry * i zend_uint num_interfaces = ++class_entry->num_interfaces; class_entry->interfaces = (zend_class_entry **) realloc(class_entry->interfaces, sizeof(zend_class_entry *) * num_interfaces); class_entry->interfaces[num_interfaces-1] = interface_entry; + zend_hash_copy(&class_entry->function_table, &interface_entry->function_table, NULL, NULL, sizeof(zend_function)); } /* }}} */ diff --git a/ext/spl/tests/forward.phpt b/ext/spl/tests/forward.phpt index 2c8a584b8a..37d2251948 100755 --- a/ext/spl/tests/forward.phpt +++ b/ext/spl/tests/forward.phpt @@ -36,6 +36,13 @@ $i = new c(); $c_info = array(class_name($i) => array('inheits' => class_parents($i), 'implements' => class_implements($i))); print_r($c_info); +$methods = get_class_methods("spl::forward_assoc"); +sort($methods); +print_r($methods); +$methods = get_class_methods($i); +sort($methods); +print_r($methods); + echo "1st try\n"; foreach($i as $w) { @@ -76,6 +83,20 @@ Array ) ) +Array +( + [0] => current + [1] => has_more + [2] => key + [3] => next +) +Array +( + [0] => current + [1] => has_more + [2] => key + [3] => next +) 1st try c::has_more c::current