From: Hannes Magnusson Date: Sat, 26 Aug 2006 14:15:07 +0000 (+0000) Subject: Fixed bug #37812 aggregate_methods_by_list fails to take certain methods X-Git-Tag: php-4.4.5RC1~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d74d887e7f26aefd6735116c7192f3f2c15916c7;p=php Fixed bug #37812 aggregate_methods_by_list fails to take certain methods Add test --- diff --git a/NEWS b/NEWS index dfe1027bdf..1f495f843a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP 4 NEWS stream wrappers). (Tony) - Fixed bug #38378 (wddx_serialize_value() generates no wellformed xml). (sj at sjaensch dot org, grzegorz dot nosek at netart dot pl, Tony). +- Fixed bug #37812 (aggregate_methods_by_list fails to take certain methods). + (Hannes) 17 Aug 2006, Version 4.4.4 - Fixed memory_limit on 64bit systems. (Stefan E.) diff --git a/ext/standard/aggregation.c b/ext/standard/aggregation.c index af7b423639..99aae10485 100644 --- a/ext/standard/aggregation.c +++ b/ext/standard/aggregation.c @@ -146,7 +146,7 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(list_hash)); while (zend_hash_get_current_key_ex(Z_ARRVAL_P(list_hash), &func_name, &func_name_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) { - if (!strncmp(func_name, from_ce->name, MIN(func_name_len-1, from_ce->name_length)) || + if (!strncmp(func_name, from_ce->name, MAX(func_name_len-1, from_ce->name_length)) || func_name[0] == '_' || zend_hash_find(&from_ce->function_table, func_name, func_name_len, (void**)&function) == FAILURE) { zend_hash_move_forward(Z_ARRVAL_P(list_hash)); diff --git a/ext/standard/tests/aggregation/bug37812.phpt b/ext/standard/tests/aggregation/bug37812.phpt new file mode 100644 index 0000000000..baa151c8a8 --- /dev/null +++ b/ext/standard/tests/aggregation/bug37812.phpt @@ -0,0 +1,55 @@ +--TEST-- +Bug #37812 (aggregate_methods_by_list fails to take certain methods) +--FILE-- +$prop = $data[$prop]; + } + } + } +} + +class User +{ + function User($id = NULL) + { + // doesn't work + aggregate_methods_by_list($this, 'Absorber', array('absorb')); + echo '
Aggregation:'.print_r(aggregation_info($this),1).'
'; + } +} +new User; +?> +--EXPECT-- +
Aggregation:Array
+(
+    [absorber] => Array
+        (
+            [methods] => Array
+                (
+                    [0] => absorb
+                )
+
+            [properties] => Array
+                (
+                )
+
+        )
+
+)
+
+