php-src/Zend/tests/traits/bug55554f.phpt
Stefan Marr e14354af21 Fixed Bug #55554 (Legacy constructors not handled properly) [TRAITS] [DOC]
# The handling of legacy constructors defined by traits was corrected.
# They are now properly registered and used on instantiation.
# The situation for conflicting legacy and __construct constructors is
# mostly identical. If they are defined in the class, they override conflicts
# and do not collide. However, in case different styles are mixed, between
# class and trait definition, we assume a programmer's mistake and report
# a collision.
#
# BTW: +1 for all the fixed tests! `make test` is fun again.
2011-10-09 11:13:27 +00:00

29 lines
565 B
PHP

--TEST--
Bug #55137 (Legacy constructor not registered for class)
--FILE--
<?php
// Ensuring that inconsistent constructor use results in an error to avoid
// problems creeping in.
trait TNew {
public function __construct() {
echo "TNew executed\n";
}
}
class ReportCollision {
use TNew;
public function ReportCollision() {
echo "ReportCollision executed\n";
}
}
echo "ReportCollision: ";
$o = new ReportCollision;
--EXPECTF--
Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d