From: flying dot mushroom at gmail dot cp, Operating system: Linux PHP version: 5.0.3 PHP Bug Type: MySQLi related Bug description: Class extended from MySQLi mangles members on calling parent method
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 bug report at http://bugs.php.net/?id=33274&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33274&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33274&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33274&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33274&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33274&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33274&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33274&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33274&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33274&r=support Expected behavior: http://bugs.php.net/fix.php?id=33274&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33274&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33274&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33274&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33274&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33274&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33274&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33274&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33274&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33274&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33274&r=mysqlcfg
