From: mc at webheberg dot com Operating system: Linux Debian PHP version: 5.0.0 PHP Bug Type: Class/Object related Bug description: Cannot override mysqli constructor
Description: ------------ I wrote a small class (named Mysql) that extends mysqli, but when I make a new Mysql(), it returns : Fatal error: Can not call constructor in .... which corresponds to line with parent::__construct It seems that we can just override mysqli methods, but not the constructor. I copy paste my code below. I found someone who recently reported this problem there : http://www.rb21.com/news/index.php?t=rview&th=40368 and didnt get any response, so I really think it's a bug. (I'm using PHP5 stable with mysqli, without mysql, and with mysql 4.1.3-beta libraries) Reproduce code: --------------- class Mysql extends mysqli { static $db_host="*"; static $db_user="*"; static $db_pass="*"; static $db_name="*"; function __construct() { parent::__construct(Mysql::$db_host, Mysql::$db_user, Mysql::$db_pass, Mysql::$db_name); } function query($query) { return parent::query($query); } }a -- Edit bug report at http://bugs.php.net/?id=29311&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29311&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29311&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29311&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29311&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29311&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29311&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29311&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29311&r=support Expected behavior: http://bugs.php.net/fix.php?id=29311&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29311&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29311&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29311&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29311&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29311&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29311&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29311&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29311&r=float