cvs: ZendEngine2 / zend_builtin_functions.c /tests bug38942.phpt
| From: | Dmitry Stogov | Date: | Tue, 26 Sep 2006 07:55:40 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c /tests bug38942.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5270@lists.php.net to get a copy of this message | ||
dmitry Tue Sep 26 07:55:40 2006 UTC
Modified files:
/ZendEngine2 zend_builtin_functions.c
/ZendEngine2/tests bug38942.phpt
Log:
Fixed bug #38942 (Double old-style-ctor inheritance)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.325&r2=1.326&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.325 ZendEngine2/zend_builtin_functions.c:1.326
--- ZendEngine2/zend_builtin_functions.c:1.325 Thu Sep 21 23:58:06 2006
+++ ZendEngine2/zend_builtin_functions.c Tue Sep 26 07:55:40 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.325 2006/09/21 23:58:06 pollita Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.326 2006/09/26 07:55:40 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -922,9 +922,23 @@
instanceof_function(EG(scope), mptr->common.scope TSRMLS_CC))
|| ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
EG(scope) == mptr->common.scope)))) {
- MAKE_STD_ZVAL(method_name);
- ZVAL_TEXT(method_name, mptr->common.function_name, 1);
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name, sizeof(zval *), NULL);
+ zstr key;
+ uint key_len;
+ ulong num_index;
+ uint len =
UG(unicode)?u_strlen(mptr->common.function_name.u):strlen(mptr->common.function_name.s);
+
+ /* Do not display old-style inherited constructors */
+ if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
+ mptr->common.scope == ce ||
+ zend_hash_get_current_key_ex(&ce->function_table, &key, &key_len,
&num_index, 0, &pos) != (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING) ||
+ (UG(unicode) ?
+ (zend_u_binary_strcasecmp(key.u, key_len-1, mptr->common.function_name.u, len) == 0) :
+ (zend_binary_strcasecmp(key.s, key_len-1, mptr->common.function_name.s, len) == 0))) {
+
+ MAKE_STD_ZVAL(method_name);
+ ZVAL_TEXT(method_name, mptr->common.function_name, 1);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &method_name, sizeof(zval *), NULL);
+ }
}
zend_hash_move_forward_ex(&ce->function_table, &pos);
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug38942.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug38942.phpt
diff -u /dev/null ZendEngine2/tests/bug38942.phpt:1.2
--- /dev/null Tue Sep 26 07:55:40 2006
+++ ZendEngine2/tests/bug38942.phpt Tue Sep 26 07:55:40 2006
@@ -0,0 +1,17 @@
+--TEST--
+Bug #38942 (Double old-style-ctor inheritance)
+--FILE--
+<?php
+class foo {
+ public function foo() {}
+}
+
+class bar extends foo {
+}
+print_r(get_class_methods("bar"));
+?>
+--EXPECT--
+Array
+(
+ [0] => foo
+)