diff options
author | Stefan Marr <gron@php.net> | 2011-08-15 22:16:58 +0000 |
---|---|---|
committer | Stefan Marr <gron@php.net> | 2011-08-15 22:16:58 +0000 |
commit | 4a51ea4b81f2e3bc812ebd2b7ef9e6b4b295f1bf (patch) | |
tree | c8bc24ef419312a9430e75a37c3d446eb1a021e5 /Zend/zend_compile.c | |
parent | 0500cffb2e17d34ee1174dffe58c1f277d62a3a3 (diff) | |
download | php-git-4a51ea4b81f2e3bc812ebd2b7ef9e6b4b295f1bf.tar.gz |
Bug #55424 Fatal error when calling a method from a trait that is defined in parent class and required by using an abstract method in the trait.
# The method got unconditionally deleted from the class, since it was assumed that we override it, but we did not in case of abstract methods coming from a trait. Thus, dont delete when we try to merge in an abstract method.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 59e0193194..cd883cbe6f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3635,10 +3635,13 @@ static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int } else if (existing_fn->common.scope != ce) { add = 1; /* or inherited from other class or interface */ /* it is just a reference which was added to the subclass while doing the inheritance */ - /* prototype = existing_fn; */ - /* memory is scrambled anyway???? */ - /* function_add_ref(prototype); */ - zend_hash_quick_del(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h); + /* so we can deleted now, and will add the overriding method afterwards */ + + /* except, if we try to add an abstract function, then we should not delete the inherited one */ + /* delete inherited fn if the function to be added is not abstract */ + if ((fn->common.fn_flags & ZEND_ACC_ABSTRACT) == 0) { + zend_hash_quick_del(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h); + } } if (add) { |