lbarnaud                Thu May 21 16:01:22 2009 UTC

  Added files:                 
    /php-src/ext/reflection/tests       bug48336.phpt 

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
  Log:
  Fixed bug #48336 (ReflectionProperty::getDeclaringClass() does not 
  work with redeclared property) 
  (patch by Markus dot Lidel at shadowconnect dot com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.343&r2=1.344&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.343 
php-src/ext/reflection/php_reflection.c:1.344
--- php-src/ext/reflection/php_reflection.c:1.343       Mon Apr 27 19:46:02 2009
+++ php-src/ext/reflection/php_reflection.c     Thu May 21 16:01:22 2009
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.343 2009/04/27 19:46:02 felipe Exp $ */
+/* $Id: php_reflection.c,v 1.344 2009/05/21 16:01:22 lbarnaud Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -4843,6 +4843,10 @@
                        break;
                }
                ce = tmp_ce;
+               if (tmp_ce == tmp_info->ce) {
+                       /* declared in this class, done */
+                       break;
+               }
                tmp_ce = tmp_ce->parent;
        }
 
@@ -5683,7 +5687,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Revision: 1.343 $");
+       php_info_print_table_row(2, "Version", "$Revision: 1.344 $");
 
        php_info_print_table_end();
 } /* }}} */
@@ -5697,7 +5701,7 @@
        NULL,
        NULL,
        PHP_MINFO(reflection),
-       "$Revision: 1.343 $",
+       "$Revision: 1.344 $",
        STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug48336.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug48336.phpt
+++ php-src/ext/reflection/tests/bug48336.phpt
--TEST--
Bug #48286 (ReflectionProperty::getDeclaringClass() does not work with 
redeclared properties)
--FILE--
<?php
class A {
}

class B extends A {
  static protected $prop;
}

class C extends B {
  static protected $prop;
}

class D extends C {
}

class E extends D {
}

class F extends E {
  static protected $prop;
}

$class = 'A';
for($class = 'A'; $class <= 'F'; $class ++) {
  print($class.' => ');
  try {
    $rp = new ReflectionProperty($class, 'prop');
    print($rp->getDeclaringClass()->getName());
  } catch(Exception $e) {
    print('N/A');
  }
  print("\n");
}
?>
--EXPECT--
A => N/A
B => B
C => C
D => C
E => C
F => F



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

Reply via email to