diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug69427.phpt | 27 | ||||
-rw-r--r-- | Zend/zend_object_handlers.c | 2 |
3 files changed, 30 insertions, 1 deletions
@@ -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; |