php-src/Zend/tests/traits/bug55424.phpt

36 lines
610 B
Plaintext
Raw Normal View History

--TEST--
Bug #55424 (Method got missing from class when a trait defined an abstract method to express a requirement)
--FILE--
<?php
2020-02-04 05:52:20 +08:00
trait ATrait
{
function setRequired()
{
$this->setAttribute();
}
2020-02-04 05:52:20 +08:00
abstract function setAttribute();
}
2020-02-04 05:52:20 +08:00
class Base
{
function setAttribute() { }
}
2020-02-04 05:52:20 +08:00
class MyClass extends Base
{
use ATrait;
}
2020-02-04 05:52:20 +08:00
$i = new Base();
$i->setAttribute();
2020-02-04 05:52:20 +08:00
$t = new MyClass();
/* setAttribute used to disappear for no good reason. */
$t->setRequired();
echo 'DONE';
?>
--EXPECT--
DONE