#35720 [Opn->Csd]: A final constructor can be overwritten

From: Date: Sat, 17 Dec 2005 15:54:12 +0000
Subject: #35720 [Opn->Csd]: A final constructor can be overwritten
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90596@lists.php.net to get a copy of this message
ID: 35720 Updated by: helly@php.net Reported By: oancea at gmail dot com -Status: Open +Status: Closed Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.1.1 Assigned To: helly New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-12-17 15:31:02] oancea at gmail dot com Description: ------------ Since php allows constructors in old fashion to keep a BC with version 4, one could overwrite this constructor by using the new php 5 syntax: __construct. [aurelian@gremlin ~]$ php -v PHP 5.1.1 (cli) (built: Dec 4 2005 16:11:20) Copyright (c) 1997-2005 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies Reproduce code: --------------- class Base { public final function __construct() { } } class Extended extends Base { public function Extended() { echo __METHOD__."\n"; } } $e= new Extended(); Expected result: ---------------- PHP Fatal error: Cannot override final method Base::__construct() Actual result: -------------- Extended::Extended ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35720&edit=1

« previous php.bugs (#90596) next »