From: apann at personal dot ro
Operating system: Win/Linux
PHP version: 5.0.4
PHP Bug Type: Scripting Engine problem
Bug description: "new self" should return the extended class
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 bug report at http://bugs.php.net/?id=33486&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33486&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33486&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33486&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33486&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33486&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33486&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33486&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33486&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33486&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33486&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33486&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33486&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33486&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33486&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33486&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33486&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33486&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33486&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33486&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33486&r=mysqlcfg