diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-01-13 11:41:57 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-01-13 11:41:57 +0300 |
commit | 50be2c89bed61a1928cd1dd0c226fe62769344dd (patch) | |
tree | 11866683fc130b90d3cfd5248a538b7b07e957ed /Zend/zend_inheritance.c | |
parent | c3c6ab08fe2125969cc769b1862623069d021a97 (diff) | |
download | php-git-50be2c89bed61a1928cd1dd0c226fe62769344dd.tar.gz |
Fixed bug #71248 (Wrong interface is enforced)
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r-- | Zend/zend_inheritance.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index ac98627b10..9eb7a0b9c9 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; } |