php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38144 mysqli_real_connect
Submitted: 2006-07-19 15:30 UTC Modified: 2017-04-13 13:13 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: traufeisen@php.net Assigned: mysql (profile)
Status: Closed Package: MySQLi related
PHP Version: 5CVS-2006-07-19 (CVS) OS: CentOS 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: traufeisen@php.net
New email:
PHP Version: OS:

 

 [2006-07-19 15:30 UTC] traufeisen@php.net
Description:
------------
Hi,
the mysql client libs allow using a user specified "my.cnf".
Such a configfile can already be set with mysqli_options and MYSQLI_READ_DEFAULT_FILE.
The configfile can contain a password for connections. Such a password is only read, if the password-parameter to the mysql_real_connect c-function is NULL.
Passing NULL as password to mysqli_real_connect gets converted to an empty string during zend_parse_method_parameters, so the configfile is not used for a password.
At http://www.phpschlampe.de/mysqli.patch is a tiny patch to allow NULL-values for the password. This patch is against 5.2.
After patching the following works:

<?php
$mysqli = mysqli_init();
mysqli_options($mysqli,MYSQLI_READ_DEFAULT_FILE,"/path/to/.my.cnf");
/*pass NULL as user/pass so that the values in the config-file are used*/
mysqli_real_connect($mysqli,"foo.bar.de",NULL,NULL); 
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:41 UTC] jani@php.net
-Package: Feature/Change Request +Package: MySQLi related
 [2011-01-06 15:05 UTC] uw@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2011-01-06 15:05 UTC] uw@php.net
I'm no fan of it. mysqlnd does not support client config files anyway.
 [2017-04-13 13:13 UTC] fjanisze@php.net
-Status: Assigned +Status: Closed
 [2017-04-13 13:13 UTC] fjanisze@php.net
This problem is not reproducible anymore in recent releases, NULL can be submitted as username/pass and the config file will be then used.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC