|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35720 A final constructor can be overwritten
Submitted: 2005-12-17 15:31 UTC Modified: 2005-12-17 16:54 UTC
From: oancea at gmail dot com Assigned: helly (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.1.1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: oancea at gmail dot com
New email:
PHP Version: OS:


 [2005-12-17 15:31 UTC] oancea at gmail dot com
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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-17 16:54 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 23:01:27 2023 UTC