ID:               27193
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
-Operating System: linux
+Operating System: *
-PHP Version:      5CVS-2004-02-09 (dev)
+PHP Version:      5*
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

expected behavior,

using old style constructors means using unrelated constructors.

using new style constructors means all rules apply. Hence you cannot
decrease visility.


Previous Comments:
------------------------------------------------------------------------

[2004-02-09 10:22:50] [EMAIL PROTECTED]

Description:
------------
While it's no problem to change the visibility of a constructor (limit
the visibility) when using the old way of declaring a constructor
(function with the same name as the class), it's not possible to lower
the visibility in a hierarchy where the constructors are named after
the new standard : __construct() .
The engine have to check whether the name is __construct() (what about
__destruct()? ), and not to complain in this case that the visibility
is lowered.

The first example emits a fatal error. The second is perfectly valid.

Reproduce code:
---------------
php -r 'class a{public function __construct() {}} class b extends a
{private function __construct(){}}'

php -r 'class a{public function a() {}} class b extends a {private
function b(){}}'

Actual result:
--------------
PHP Fatal error:  Access level to b::__construct() must be public (as
in class a) in Command line code on line 1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27193&edit=1

Reply via email to