helly           Wed Jan 16 14:21:07 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/reflection/tests       bug37964.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - MFH Fixed Bug #37964 (Reflection shows private methods of parent class)
    ([EMAIL PROTECTED])
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.71&r2=1.2027.2.547.2.965.2.72&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.71 
php-src/NEWS:1.2027.2.547.2.965.2.72
--- php-src/NEWS:1.2027.2.547.2.965.2.71        Mon Jan 14 13:46:34 2008
+++ php-src/NEWS        Wed Jan 16 14:21:07 2008
@@ -106,6 +106,8 @@
   segfault later on). (Dmitry)
 - Fixed bug #39056 (Interbase NUMERIC data type error). (Lars W)
 - Fixed bug #38468 (Unexpected creation of cycle). (Dmitry)
+- Fixed bug #37964 (Reflection shows private methods of parent class).
+  (Felipe, Marcus)
 - Fixed bug #37911 (preg_replace_callback() ignores named groups). (Nuno)
 - Fixed bug #36128 (Interbase PDO - timestamp columns return NULL). (Lars W)
 - Fixed bug #35386 (firebird: first row is null). (Lars W)
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.6&r2=1.164.2.33.2.45.2.7&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.6 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.7
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.6 Mon Dec 31 
07:17:13 2007
+++ php-src/ext/reflection/php_reflection.c     Wed Jan 16 14:21:07 2008
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.6 2007/12/31 07:17:13 sebastian 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.7 2008/01/16 14:21:07 helly Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -519,7 +519,8 @@
                        
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
 
                        while 
(zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == 
SUCCESS) {
-                               if (!(mptr->common.fn_flags & ZEND_ACC_STATIC)) 
{
+                               if ((mptr->common.fn_flags & ZEND_ACC_STATIC) 
== 0 &&
+                                       ((mptr->common.fn_flags & 
ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce)) {
                                        char *key;
                                        uint key_len;
                                        ulong num_index;
@@ -539,6 +540,9 @@
                                zend_hash_move_forward_ex(&ce->function_table, 
&pos);
                        }
                        string_printf(str, "\n%s  - Methods [%d] {", indent, 
count);
+                       if (!count) {
+                               string_printf(str, "\n");
+                       }
                        string_append(str, &dyn);
                        string_free(&dyn);
                } else {
@@ -4909,7 +4913,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.164.2.33.2.45.2.6 2007/12/31 07:17:13 sebastian Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.45.2.7 2008/01/16 14:21:07 helly Exp $");
 
        php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug37964.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug37964.phpt
+++ php-src/ext/reflection/tests/bug37964.phpt
--TEST--
Reflection Bug #37964 (Reflection shows private methods of parent class)
--FILE--
<?php

abstract class foobar {
        private function test2() {
        }       
}
class foo extends foobar {
        private $foo = 1;
        private function test() {
        }
        protected function test3() {
        }
}
class bar extends foo {
        private function foobar() {
        }
}

Reflection::export(new ReflectionClass(new bar));

?>
--EXPECTF--
Class [ <user> class bar extends foo ] {
  @@ %s %s

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [2] {
    Method [ <user> private method foobar ] {
      @@ %s %d - %d
    }

    Method [ <user, inherits foo> protected method test3 ] {
      @@ %s %d - %d
    }
  }
}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to