summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/bug69420.phpt30
-rw-r--r--Zend/zend_inheritance.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_inheritance.c b/Zend/zend_inheritance.c
index e203599aea..4f31529a85 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1108,6 +1108,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
/* 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);
+ fn->common.prototype = NULL;
}
}