PHP :: Bug #29311 :: Cannot override mysqli constructor
| Bug #29311 | Cannot override mysqli constructor | ||||
|---|---|---|---|---|---|
| Submitted: | 2004-07-21 23:16 UTC | Modified: | 2004-07-23 14:49 UTC | ||
| From: | mc at webheberg dot com | Assigned: | |||
| Status: | Closed | Package: | Class/Object related | ||
| PHP Version: | 5.0.0 | OS: | Linux Debian | ||
| Private report: | No | CVE-ID: | None | ||
[2004-07-21 23:16 UTC] mc at webheberg dot com
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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-07-22 00:47 UTC] mc at webheberg dot com
[2004-07-23 14:49 UTC] georg@php.net