#33486 [Opn->Bgs]: "new self" should return the extended class
| From: | sniper@php.net | Date: | Mon, 27 Jun 2005 07:33:35 +0000 |
| Subject: | #33486 [Opn->Bgs]: "new self" should return the extended class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81063@lists.php.net to get a copy of this message | ||
ID: 33486
Updated by: sniper@php.net
Reported By: apann at personal dot ro
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5CVS-2005-06-27
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2005-06-27 08:52:00] apann at personal dot ro
The expected result should be:
Base::__construct
Ext_One::__construct
Base::__construct
Ext_Two::__construct
------------------------------------------------------------------------
[2005-06-27 08:49:52] apann at personal dot ro
Description:
------------
See "reproduce code" section.
The same thing happens with php version 5.0.3, 5.0.4 and
5.1.0-from_cvs.
Os: Mandriva Linux/Ubuntu/Win XP/Win 2000.
Reproduce code:
---------------
<?php
class Base {
public function __construct() {
echo __METHOD__ . "\n";
}
public static function run() {
return new self;
}
}
class Ext_One extends Base {
public function __construct() {
parent::__construct();
echo __METHOD__ . "\n";
}
}
class Ext_Two extends Base {
public function __construct() {
parent::__construct();
echo __METHOD__ . "\n";
}
}
$o1 = Ext_One::run();
$o2 = Ext_Two::run();
Expected result:
----------------
Ext_One::__construct
Base::__construct
Ext_Two::__construct
Base::__construct
Actual result:
--------------
Base::__construct
Base::__construct
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33486&edit=1