com php-src: Fixed bug #69427 (Segfault on magic method __call of private method in superclass): NE WS Zend/tests/bug69427.phpt Zend/zend_object
_handlers.c
| From: | Xinchen Hui | Date: | Sat, 11 Apr 2015 15:57:42 +0000 |
| Subject: | com php-src: Fixed bug #69427 (Segfault on magic method __call of private method in superclass): NE WS Zend/tests/bug69427.phpt Zend/zend_object _handlers.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86162@lists.php.net to get a copy of this message | ||
Commit: cefad04f0d20b45d5cb9b572f7253b45f33bd737
Author: Xinchen Hui <laruence@php.net> Sat, 11 Apr 2015 23:57:42 +0800
Parents: 5da41790f755e6ef4777161813dcdfbf85ab3359
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cefad04f0d20b45d5cb9b572f7253b45f33bd737
Log:
Fixed bug #69427 (Segfault on magic method __call of private method in superclass)
Bugs:
https://bugs.php.net/69427
Changed paths:
M NEWS
A Zend/tests/bug69427.phpt
M Zend/zend_object_handlers.c
Diff:
diff --git a/NEWS b/NEWS
index 3da1254..175ec09 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 0000000..6b739df
--- /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 753c2ab..679a104 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;