From:             [EMAIL PROTECTED]
Operating system: linux
PHP version:      5CVS-2004-02-23 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  A protected parent constructor cannot be callen

Description:
------------
By default if a constructor in a subclass is not defined the constructor
of the parent class is being called (see example 1).

However, if the parent constructor is declared "protected" and is visible
to the child, the engine refuses to execute the constructor (Example 2 and
result 2).

Example 3 shows that the parent constructor is visible in the child when
an explicit constructor is provided there.

Reproduce code:
---------------
Ex. 1:

php -r 'class a { function a() {echo "const of a\n";}} class b extends a
{} $a = new b();'



Ex. 2:

php -r 'class a { protected function a() {echo "const of a\n";}} class b
extends a {} $a = new b();'



Ex. 3:

php -r 'class a { protected function a() {echo "const of a\n";}} class b
extends a {public function b(){parent::a();}} $a = new b();'



Expected result:
----------------
const of a

const of a

const of a

Actual result:
--------------
Result 1 :

const of a



Result 2 :

PHP Fatal error:  Call to protected a::a() from context '' in Command line
code on line 1



Result 3 :

const of a

-- 
Edit bug report at http://bugs.php.net/?id=27367&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27367&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27367&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27367&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27367&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27367&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27367&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27367&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27367&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27367&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27367&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27367&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27367&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27367&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27367&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27367&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27367&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27367&r=float

Reply via email to