#38998 [Opn->Bgs]: wrong default values in constructor

From: Date: Mon, 02 Oct 2006 08:54:52 +0000
Subject: #38998 [Opn->Bgs]: wrong default values in constructor
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102965@lists.php.net to get a copy of this message
ID: 38998 Updated by: tony2001@php.net Reported By: camka at email dot ee -Status: Open +Status: Bogus Bug Type: MySQLi related Operating System: win 2000 PHP Version: 5.1.6 New Comment: NULL values passed as parameter to mysqli::__construct() have a special meaning, which are described in the docs. Previous Comments: ------------------------------------------------------------------------ [2006-09-29 22:42:06] camka at email dot ee Description: ------------ If passing NULL parameters in mysqli::__construct, as they are by default, the values are not actually taken from php.ini (or apache conf) file. Tested with both 5.1.6 and 5.2 latest snapshot. Reproduce code: --------------- virtual host conf: php_admin_value "mysqli.default_host" zorro php_admin_value "mysqli.default_user" rootf php_admin_value "mysqli.default_pw" ff <? $m = new mysqli(); echo mysqli_connect_error(), "\n"; $m = new mysqli(null); echo mysqli_connect_error(), "\n"; $m = new mysqli(null, null); echo mysqli_connect_error(), "\n"; $m = new mysqli(null, null, null); echo mysqli_connect_error(), "\n"; ?> Expected result: ---------------- Access denied for user 'rootf'@'zorro' (using password: YES) Access denied for user 'rootf'@'zorro' (using password: YES) Access denied for user 'rootf'@'zorro' (using password: YES) Access denied for user 'rootf'@'zorro' (using password: YES) Actual result: -------------- [empty] Access denied for user 'rootf'@'localhost' (using password: YES) Access denied for user 'ODBC'@'localhost' (using password: YES) Access denied for user 'ODBC'@'localhost' (using password: NO) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38998&edit=1

« previous php.bugs (#102965) next »