ce->destructor = ce->parent->destructor;
}
if (ce->constructor) {
+ if (ce->parent->constructor && ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL) {
+ zend_error(E_ERROR, "Cannot override final %s::%s() with %s::%s()",
+ ce->parent->name, ce->parent->constructor->common.function_name,
+ ce->name, ce->constructor->common.function_name
+ );
+ }
return;
}
--- /dev/null
+--TEST--
+ZE2 cannot override final __construct
+--FILE--
+<?php
+
+class Base
+{
+ public final function __construct()
+ {
+ }
+}
+
+class Works extends Base
+{
+}
+
+class Extended extends Base
+{
+ public function Extended()
+ {
+ }
+}
+
+ReflectionClass::export('Extended');
+
+?>
+--EXPECTF--
+
+Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
--- /dev/null
+--TEST--
+ZE2 cannot override final old style ctor
+--FILE--
+<?php
+
+class Base
+{
+ public final function Base()
+ {
+ }
+}
+
+class Works extends Base
+{
+}
+
+class Extended extends Base
+{
+ public function __construct()
+ {
+ }
+}
+
+ReflectionClass::export('Extended');
+
+?>
+--EXPECTF--
+
+Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d