cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38942.phpt
| From: | Dmitry Stogov | Date: | Tue, 26 Sep 2006 07:55:54 +0000 |
| Subject: | cvs: php-src /ext/reflection php_reflection.c /ext/reflection/tests bug38942.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-40709@lists.php.net to get a copy of this message | ||
dmitry Tue Sep 26 07:55:54 2006 UTC
Modified files:
/php-src/ext/reflection php_reflection.c
/php-src/ext/reflection/tests bug38942.phpt
Log:
Fixed bug #38942 (Double old-style-ctor inheritance)
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.255&r2=1.256&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.255 php-src/ext/reflection/php_reflection.c:1.256
--- php-src/ext/reflection/php_reflection.c:1.255 Sun Sep 17 09:39:04 2006
+++ php-src/ext/reflection/php_reflection.c Tue Sep 26 07:55:54 2006
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_reflection.c,v 1.255 2006/09/17 09:39:04 johannes Exp $ */
+/* $Id: php_reflection.c,v 1.256 2006/09/26 07:55:54 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -511,8 +511,22 @@
while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos)
== SUCCESS) {
if (!(mptr->common.fn_flags & ZEND_ACC_STATIC)) {
- string_printf(str, "\n");
- _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC);
+ 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))) {
+
+ string_printf(str, "\n");
+ _function_string(str, mptr, ce, sub_indent.string TSRMLS_CC);
+ }
}
zend_hash_move_forward_ex(&ce->function_table, &pos);
}
@@ -4882,7 +4896,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "Reflection", "enabled");
- php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.255 2006/09/17
09:39:04 johannes Exp $");
+ php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.256 2006/09/26
07:55:54 dmitry Exp $");
php_info_print_table_end();
} /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38942.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/reflection/tests/bug38942.phpt
diff -u /dev/null php-src/ext/reflection/tests/bug38942.phpt:1.2
--- /dev/null Tue Sep 26 07:55:54 2006
+++ php-src/ext/reflection/tests/bug38942.phpt Tue Sep 26 07:55:54 2006
@@ -0,0 +1,34 @@
+--TEST--
+Bug #38942 (Double old-style-ctor inheritance)
+--FILE--
+<?php
+class foo {
+ public function foo() {}
+}
+
+class bar extends foo {
+}
+ReflectionClass::export("bar");
+?>
+--EXPECTF--
+Class [ <user> class bar extends foo ] {
+ @@ %sbug38942.php 6-7
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [2] {
+ Method [ <user, inherits foo, ctor> public method foo ] {
+ @@ %sbug38942.php 3 - 3
+ }
+ }
+}