laruence                                 Thu, 24 Nov 2011 09:16:11 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=319745

Log:
Fixed bug #60367 (Reflection and Late Static Binding)

Bug: https://bugs.php.net/60367 (Assigned) Reflection and Late Static Binding
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
    A   php/php-src/branches/PHP_5_3/ext/reflection/tests/bug60367.phpt
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c
    A   php/php-src/branches/PHP_5_4/ext/reflection/tests/bug60367.phpt
    U   php/php-src/trunk/ext/reflection/php_reflection.c
    A   php/php-src/trunk/ext/reflection/tests/bug60367.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-11-24 08:47:22 UTC (rev 319744)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-11-24 09:16:11 UTC (rev 319745)
@@ -75,6 +75,9 @@
   . Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference).
     (Maksymilian Arciemowicz, Felipe)

+- Reflection:
+  . Fixed bug #60367 (Reflection and Late Static Binding). (Laruence)
+
 03 Nov 2011, PHP 5.3.9RC1

 - Core:

Modified: php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c        
2011-11-24 08:47:22 UTC (rev 319744)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c        
2011-11-24 09:16:11 UTC (rev 319745)
@@ -2635,7 +2635,7 @@
        fcc.initialized = 1;
        fcc.function_handler = mptr;
        fcc.calling_scope = obj_ce;
-       fcc.called_scope = obj_ce;
+       fcc.called_scope = intern->ce;
        fcc.object_ptr = object_ptr;

        result = zend_call_function(&fci, &fcc TSRMLS_CC);

Added: php/php-src/branches/PHP_5_3/ext/reflection/tests/bug60367.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/reflection/tests/bug60367.phpt             
                (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/reflection/tests/bug60367.phpt     
2011-11-24 09:16:11 UTC (rev 319745)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #60367 (Reflection and Late Static Binding)
+--FILE--
+<?php
+abstract class A {
+
+       const WHAT = 'A';
+
+       public static function call() {
+               echo static::WHAT;
+       }
+
+}
+
+class B extends A {
+
+       const WHAT = 'B';
+
+}
+
+$method = new ReflectionMethod("b::call");
+$method->invoke(null);
+$method = new ReflectionMethod("A::call");
+$method->invoke(null);
+--EXPECTF--
+BA

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2011-11-24 08:47:22 UTC (rev 319744)
+++ php/php-src/branches/PHP_5_4/NEWS   2011-11-24 09:16:11 UTC (rev 319745)
@@ -66,6 +66,7 @@
 - Reflection:
   . Fixed bug #60357 (__toString() method triggers E_NOTICE "Array to string
     conversion"). (Laruence)
+  . Fixed bug #60367 (Reflection and Late Static Binding). (Laruence)

 - SOAP extension:
   . Added new SoapClient option "keep_alive". FR #60329. (Pierrick)

Modified: php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c        
2011-11-24 08:47:22 UTC (rev 319744)
+++ php/php-src/branches/PHP_5_4/ext/reflection/php_reflection.c        
2011-11-24 09:16:11 UTC (rev 319745)
@@ -2811,7 +2811,7 @@
        fcc.initialized = 1;
        fcc.function_handler = mptr;
        fcc.calling_scope = obj_ce;
-       fcc.called_scope = obj_ce;
+       fcc.called_scope = intern->ce;
        fcc.object_ptr = object_ptr;

        result = zend_call_function(&fci, &fcc TSRMLS_CC);

Added: php/php-src/branches/PHP_5_4/ext/reflection/tests/bug60367.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/reflection/tests/bug60367.phpt             
                (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/reflection/tests/bug60367.phpt     
2011-11-24 09:16:11 UTC (rev 319745)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #60367 (Reflection and Late Static Binding)
+--FILE--
+<?php
+abstract class A {
+
+       const WHAT = 'A';
+
+       public static function call() {
+               echo static::WHAT;
+       }
+
+}
+
+class B extends A {
+
+       const WHAT = 'B';
+
+}
+
+$method = new ReflectionMethod("b::call");
+$method->invoke(null);
+$method = new ReflectionMethod("A::call");
+$method->invoke(null);
+--EXPECTF--
+BA

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===================================================================
--- php/php-src/trunk/ext/reflection/php_reflection.c   2011-11-24 08:47:22 UTC 
(rev 319744)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2011-11-24 09:16:11 UTC 
(rev 319745)
@@ -2811,7 +2811,7 @@
        fcc.initialized = 1;
        fcc.function_handler = mptr;
        fcc.calling_scope = obj_ce;
-       fcc.called_scope = obj_ce;
+       fcc.called_scope = intern->ce;
        fcc.object_ptr = object_ptr;

        result = zend_call_function(&fci, &fcc TSRMLS_CC);

Added: php/php-src/trunk/ext/reflection/tests/bug60367.phpt
===================================================================
--- php/php-src/trunk/ext/reflection/tests/bug60367.phpt                        
        (rev 0)
+++ php/php-src/trunk/ext/reflection/tests/bug60367.phpt        2011-11-24 
09:16:11 UTC (rev 319745)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #60367 (Reflection and Late Static Binding)
+--FILE--
+<?php
+abstract class A {
+
+       const WHAT = 'A';
+
+       public static function call() {
+               echo static::WHAT;
+       }
+
+}
+
+class B extends A {
+
+       const WHAT = 'B';
+
+}
+
+$method = new ReflectionMethod("b::call");
+$method->invoke(null);
+$method = new ReflectionMethod("A::call");
+$method->invoke(null);
+--EXPECTF--
+BA

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

Reply via email to