PHP 4.0 Bug #9618: Strange behaviour initialing extended class

From: Date: Thu, 08 Mar 2001 11:51:35 +0000
Subject: PHP 4.0 Bug #9618: Strange behaviour initialing extended class
Groups: php.dev 
Request: Send a blank email to php-dev+get-48233@lists.php.net to get a copy of this message
From: arzga@tky.hut.fi Operating system: linux/rh7.0 std PHP version: 4.0.3pl1 PHP Bug Type: Scripting Engine problem Bug description: Strange behaviour initialing extended class Hi, PHP acts strangely when calling a parent class constructor from an extended class. PHP4 seems to call the constructor without arguments instead of the one with the right number of arguments. Regards, Ari Nykänen // -------- clip clip clip ---------------- <script language="php"> class Huikkari { var $huikkasana="initial"; function Huikkari($huikkasana) { $this->huikkasana=$huikkasana; } function Huikkari() { $this->huikkasana="default"; } function huikkaa () { echo ($this->huikkasana."\n"); return true; } } class HelloHuikkari extends Huikkari { function helloHuikkari () { // *** possible problem here *** the following line seems // to call the Huikkari constructor with no arguments $this->Huikkari('Hello World'); } } $helloHuikkari = new HelloHuikkari(); // I think the following line should // output 'Hello World' instead of 'defaultt' $helloHuikkari->huikkaa(); </script> -- Edit Bug report at: http://bugs.php.net/?id=9618&edit=1

« previous php.dev (#48233) next »