ID: 33274 Updated by: [EMAIL PROTECTED] Reported By: flying dot mushroom at gmail dot com -Status: Open +Status: Feedback Bug Type: MySQLi related Operating System: Linux PHP Version: 5.0.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-06-08 12:27:00] flying dot mushroom at gmail dot com Description: ------------ A class that extends mysqli, if passing its own members directly to the parent constructor, will have those members mangled after the call. Assigning member values to local variables and then passing those to the parent solves the problem on for the user, but the above behaviour shouldn't happen...? (Replacing the line "parent::__construct($this->p_host, $this->p_uname, $this->p_password);" with "parent::__construct($host, $username, $password);" produces the expected result.) This same problem is reported on the comment by hans at lintoo dot dk on http://www.php.net/manual/en/ref.mysqli.php Reproduce code: --------------- <?php class db_mysql extends mysqli { private $p_host; private $p_uname = ''; private $p_password = ''; public function __construct($host, $username = '', $password = '') { $this->p_host = $host; $this->p_uname = $username; $this->p_password = $password; parent::__construct($this->p_host, $this->p_uname, $this->p_password); } } var_dump(new db_mysql('localhost', 'username', 'password')); ?> Expected result: ---------------- object(db_mysql)#1 (3) { ["p_host:private"]=> string(9) "localhost" ["p_uname:private"]=> string(8) "username" ["p_password:private"]=> string(8) "password" } Actual result: -------------- object(db_mysql)#1 (3) { ["p_host:private"]=> string(9) "localhost" ["p_uname:private"]=> string(8) "username" ["p_password:private"]=> NULL } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33274&edit=1
