summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-04-11 23:57:42 +0800
committerXinchen Hui <laruence@php.net>2015-04-11 23:57:42 +0800
commitcefad04f0d20b45d5cb9b572f7253b45f33bd737 (patch)
tree63a245aa2a6cf84c04439a033822c27a004ce31e
parent5da41790f755e6ef4777161813dcdfbf85ab3359 (diff)
downloadphp-git-cefad04f0d20b45d5cb9b572f7253b45f33bd737.tar.gz
Fixed bug #69427 (Segfault on magic method __call of private method in superclass)
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug69427.phpt27
-rw-r--r--Zend/zend_object_handlers.c2
3 files changed, 30 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 3da1254415..175ec09dae 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@
. Update the MIME type list from the one shipped by Apache HTTPD. (Adam)
- Core:
+ . Fixed bug #69427 (Segfault on magic method __call of private method in
+ superclass). (Laruence)
. Improved __call() and __callStatic() magic method handling. Now they are
called in a stackless way using ZEND_CALL_TRAMPOLINE opcode, without
additional stack frame. (Laruence, Dmitry)
diff --git a/Zend/tests/bug69427.phpt b/Zend/tests/bug69427.phpt
new file mode 100644
index 0000000000..6b739df961
--- /dev/null
+++ b/Zend/tests/bug69427.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #69427 (Segfault on magic method __call of private method in superclass)
+--FILE--
+<?php
+
+class SubClass extends BaseClass
+{
+}
+
+abstract class BaseClass
+{
+ public function __call($name, $arguments)
+ {
+ return $this->$name();
+ }
+
+ private function foobar()
+ {
+ return 'okey';
+ }
+}
+
+$test = new SubClass();
+echo $test->foobar();
+?>
+--EXPECT--
+okey
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 753c2abc78..679a104a59 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -1014,8 +1014,8 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend
func->this_var = -1;
func->opcodes = &EG(call_trampoline_op);
- func->scope = ce;
func->prototype = fbc;
+ func->scope = fbc->common.scope;
func->filename = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.filename : STR_EMPTY_ALLOC();
func->line_start = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_start : 0;
func->line_end = (fbc->type == ZEND_USER_FUNCTION)? fbc->op_array.line_end : 0;