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/tests/traits | |
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/tests/traits')
-rw-r--r-- | Zend/tests/traits/bug55424.phpt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Zend/tests/traits/bug55424.phpt b/Zend/tests/traits/bug55424.phpt new file mode 100644 index 0000000000..b6c3b54515 --- /dev/null +++ b/Zend/tests/traits/bug55424.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #55424 (Method got missing from class when a trait defined an abstract method to express a requirement) +--FILE-- +<?php + + trait ATrait + { + function setRequired() + { + $this->setAttribute(); + } + + abstract function setAttribute(); + } + + class Base + { + function setAttribute() { } + } + + class MyClass extends Base + { + use ATrait; + } + + $i = new Base(); + $i->setAttribute(); + + $t = new MyClass(); + /* setAttribute used to disappear for no good reason. */ + $t->setRequired(); + echo 'DONE'; +?> +--EXPECT-- +DONE |