lbarnaud                Thu May 21 16:05:11 2009 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/reflection/tests       bug48336.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/reflection     php_reflection.c 
  Log:
  MFH: 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/NEWS?r1=1.2027.2.547.2.1516&r2=1.2027.2.547.2.1517&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1516 php-src/NEWS:1.2027.2.547.2.1517
--- php-src/NEWS:1.2027.2.547.2.1516    Thu May 21 12:53:24 2009
+++ php-src/NEWS        Thu May 21 16:05:10 2009
@@ -16,6 +16,8 @@
 - Fixed segfault on invalid session.save_path. (Hannes)
 - Fixed leaks in imap when a mail_criteria is used. (Pierre)
 
+- Fixed bug #48336 (ReflectionProperty::getDeclaringClass() does not work with
+  redeclared property). (patch by Markus dot Lidel at shadowconnect dot com)
 - Fixed bug #48326 (constant MSG_DONTWAIT not defined). (Arnaud)
 - Fixed bug #48313 (fgetcsv() does not return null for empty rows). (Ilia)
 - Fixed bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.56&r2=1.164.2.33.2.57&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.56 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.57
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.56     Mon Apr 27 
19:54:34 2009
+++ php-src/ext/reflection/php_reflection.c     Thu May 21 16:05:11 2009
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.56 2009/04/27 19:54:34 felipe Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.57 2009/05/21 16:05:11 lbarnaud Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -4126,6 +4126,10 @@
                        break;
                }
                ce = tmp_ce;
+               if (tmp_ce == tmp_info->ce) {
+                       /* declared in this class, done */
+                       break;
+               }
                tmp_ce = tmp_ce->parent;
        }
 
@@ -4948,7 +4952,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.56 2009/04/27 19:54:34 felipe Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.57 2009/05/21 16:05:11 lbarnaud Exp $");
 
        php_info_print_table_end();
 } /* }}} */

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