From:             p dot reisinger at gmail dot com
Operating system: 
PHP version:      5.3.1
PHP Bug Type:     Class/Object related
Bug description:  final private function __construct

Description:
------------
When somebody creates final private constructor then the class that
extends this class cannot have constructor at all, even though private
methods shouldn't be visible outside of the class. So final private
constructor shouldn't allow calling parent::__construct(), but creating
constructor should be allowed.
The same happens if class has final private method, then no subclass can
use method with the same name (I know that there is no point creating
private final, but it seems a problem when there'll be final instance
variables in the future, plus it is a problem with constructors).

As I understand, parent's constructor is not called automatically, 
(parent::__construct() needs to be called) because if parent's constructor
is private but not final then the code works.

Reproduce code:
---------------
class Test {
    final private function __construct() {}
}

class SubTest extends Test {
    // private methods shouldn't be visible
    // and I am not calling parent::__construct();
    public function __construct() {}
}


-- 
Edit bug report at http://bugs.php.net/?id=50302&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50302&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50302&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50302&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50302&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50302&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50302&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50302&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50302&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50302&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50302&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50302&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50302&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50302&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50302&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50302&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50302&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50302&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50302&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50302&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50302&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50302&r=mysqlcfg

Reply via email to