summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-01-13 11:42:50 +0300
committerDmitry Stogov <dmitry@zend.com>2016-01-13 11:42:50 +0300
commitd47285648cb773ab04495c1c3411f229ebb28cd4 (patch)
treebc6de35559c49f9ccdd81d4e9f52afe1c65130e2 /Zend/zend_inheritance.c
parentbef124513e04df99ebc098ceb59e20d49508c4d6 (diff)
parent50be2c89bed61a1928cd1dd0c226fe62769344dd (diff)
downloadphp-git-d47285648cb773ab04495c1c3411f229ebb28cd4.tar.gz
Merge branch 'PHP-7.0'
* PHP-7.0: Fixed bug #71248 (Wrong interface is enforced) Update NEWS
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index ce7dd99026..c4b22849dd 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -585,7 +585,20 @@ static zend_function *do_inherit_method(zend_string *key, zend_function *parent,
zval *child = zend_hash_find(&ce->function_table, key);
if (child) {
- do_inheritance_check_on_method((zend_function*)Z_PTR_P(child), parent);
+ zend_function *func = (zend_function*)Z_PTR_P(child);
+ zend_function *orig_prototype = func->common.prototype;
+
+ do_inheritance_check_on_method(func, parent);
+ if (func->common.prototype != orig_prototype &&
+ func->type == ZEND_USER_FUNCTION &&
+ func->common.scope != ce &&
+ !func->op_array.static_variables) {
+ /* Lazy duplication */
+ zend_function *new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
+ memcpy(new_function, func, sizeof(zend_op_array));
+ Z_PTR_P(child) = new_function;
+ func->common.prototype = orig_prototype;
+ }
return NULL;
}