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=33486edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33486r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33486r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33486r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=33486r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=33486r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33486r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33486r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33486r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33486r=support
Expected behavior: http://bugs.php.net/fix.php?id=33486r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33486r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33486r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=33486r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33486r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=33486r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33486r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33486r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33486r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33486r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33486r=mysqlcfg