]> granicus.if.org Git - php/commitdiff
Fixed bug #60367 (Reflection and Late Static Binding)
authorXinchen Hui <laruence@php.net>
Thu, 24 Nov 2011 09:16:11 +0000 (09:16 +0000)
committerXinchen Hui <laruence@php.net>
Thu, 24 Nov 2011 09:16:11 +0000 (09:16 +0000)
NEWS
ext/reflection/php_reflection.c
ext/reflection/tests/bug60367.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 83b5eb98d395ef1db37c5acb7c22637ff9f4ac35..60a30952e1d60e4ff89a04fd36976f8f900caefc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,7 @@ PHP                                                                        NEWS
 - 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)
index 1e0386a601c64073ef6c4bcd4349372d3504c904..754be1483c8b10c43500ded09642911166ad1d21 100644 (file)
@@ -2811,7 +2811,7 @@ ZEND_METHOD(reflection_method, invoke)
        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);
diff --git a/ext/reflection/tests/bug60367.phpt b/ext/reflection/tests/bug60367.phpt
new file mode 100644 (file)
index 0000000..31e8a2e
--- /dev/null
@@ -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