]> granicus.if.org Git - php/commitdiff
Fixed bug #69420 (Invalid read in zend_std_get_method)
authorXinchen Hui <laruence@php.net>
Fri, 10 Apr 2015 14:47:06 +0000 (22:47 +0800)
committerXinchen Hui <laruence@php.net>
Fri, 10 Apr 2015 14:47:06 +0000 (22:47 +0800)
NEWS
Zend/tests/bug69420.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index f28c88e00e13d493cc6ccff8f19c47830c136e46..aaab16a6204469da85bdc1690e7172fc3e75a15e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP                                                                        NEWS
 ?? ??? 2015, PHP 5.5.25
 
 - Core:
+  . Fixed bug #69420 (Invalid read in zend_std_get_method). (Laruence)
   . Fixed bug #60022 ("use statement [...] has no effect" depends on leading
     backslash). (Nikita)
   . Fixed bug #67314 (Segmentation fault in gc_remove_zval_from_buffer).
diff --git a/Zend/tests/bug69420.phpt b/Zend/tests/bug69420.phpt
new file mode 100644 (file)
index 0000000..060d69c
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Bug #69420 (Invalid read in zend_std_get_method)
+--FILE--
+<?php
+
+trait T {
+       protected function test() {
+               echo "okey";
+       }
+}
+
+
+class A {
+       protected function test() {
+       }
+}
+
+class B extends A {
+       use T;
+       public function foo() {
+               $this->test();
+       }
+}
+
+
+$b = new B();
+$b->foo();
+?>
+--EXPECT--
+okey
index 94566a5d59d3ad4950421079b6f43dba9da9e392..4e61f5fd222453ed6a373543dcb6ffa7ebff6b7e 100644 (file)
@@ -3942,6 +3942,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const
                        /* inherited members are overridden by members inserted by traits */
                        /* check whether the trait method fulfills the inheritance requirements */
                        do_inheritance_check_on_method(fn, existing_fn TSRMLS_CC);
+                       fn->common.prototype = NULL;
                }
        }