]> granicus.if.org Git - php/commitdiff
Fixed bug #24871 (methods misidentified as constructors)
authorIlia Alshanetsky <iliaa@php.net>
Fri, 1 Aug 2003 02:17:31 +0000 (02:17 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 1 Aug 2003 02:17:31 +0000 (02:17 +0000)
NEWS
ext/standard/aggregation.c
ext/standard/tests/aggregation/bug24871.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index acd0d6835df9661d606192e74b00b711de0f042c..94406e69f83acb0bc2924fa4481f743adc0ea7c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP 4                                                                      NEWS
 - Fixed bug #22154 (Possible crash when memory_limit is reached and
   output buffering in addition to session.use_trans_sid is used). (Ilia)
 - Fixed bug #24883 (variables_order and gpc_order being ignored). (Ilia)
+- Fixed bug #24871 (methods misidentified as constructors). (Ilia)
 
 30 Jul 2003, Version 4.3.3RC2
 - Improved the NSAPI SAPI module (Uwe Schindler)
index 69eb36ca48ae1d3c8b0eb366cd9b61060cec7f13..a2501682490c896d2e995787be2546a80cbecb2f 100644 (file)
@@ -114,7 +114,7 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i
 
                        /* We do not aggregate:
                         * 1. constructors */
-                       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)) ||
                        /* 2. private methods (heh, like we really have them) */
                                func_name[0] == '_' ||
                        /* 3. explicitly excluded methods */
diff --git a/ext/standard/tests/aggregation/bug24871.phpt b/ext/standard/tests/aggregation/bug24871.phpt
new file mode 100644 (file)
index 0000000..ec34fd3
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #24871 (methods misidentified as constructors)
+--FILE--
+<?php
+class a { }
+
+class b {
+       function bb() {
+               var_dump(method_exists($this, "bb"));
+       }
+}
+
+$a = new a();
+aggregate($a, "b");
+$a->bb();
+?>
+--EXPECT--
+bool(true)