summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/bug69420.phpt30
-rw-r--r--Zend/zend_compile.c1
2 files changed, 31 insertions, 0 deletions
diff --git a/Zend/tests/bug69420.phpt b/Zend/tests/bug69420.phpt
new file mode 100644
index 0000000000..060d69c839
--- /dev/null
+++ b/Zend/tests/bug69420.phpt
@@ -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
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 96bf12dae5..8f127d4193 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4081,6 +4081,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;
}
}