--- /dev/null
+--TEST--
+Bug #55355 (Abstract functions required by a trait are not correctly found when implemented in an ancestor class)
+--FILE--
+<?php
+
+// A trait that has a abstract function
+trait ATrait {
+ function bar() {
+ $this->foo();
+ }
+ abstract function foo();
+}
+
+// A class on the second level in the
+// inheritance chain
+class Level2Impl {
+ function foo() {}
+}
+
+class Level1Indirect extends Level2Impl {}
+
+// A class on the first level in the
+// inheritance chain
+class Level1Direct {
+ function foo() {}
+}
+
+// Trait Uses
+
+class Direct {
+ use ATrait;
+ function foo() {}
+}
+
+class BaseL2 extends Level1Indirect {
+ use ATrait;
+}
+
+class BaseL1 extends Level1Direct {
+ use ATrait;
+}
+
+echo 'DONE';
+?>
+--EXPECT--
+DONE
zend_function* parent_function;
if (ce->parent && zend_hash_quick_find(&ce->parent->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**) &parent_function) != FAILURE) {
prototype = parent_function; /* ->common.fn_flags |= ZEND_ACC_ABSTRACT; */
+
+ /* we got that method in the parent class, and are going to override it,
+ except, if the trait is just asking to have an abstract method implemented. */
+ if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ /* then we clean up an skip this method */
+ zend_function_dtor(fn);
+ return ZEND_HASH_APPLY_REMOVE;
+ }
}
fn->common.scope = ce;