#38998 [Asn->Csd]: wrong default values in constructor
| From: | danielc@php.net | Date: | Sun, 15 Mar 2009 15:33:40 +0000 |
| Subject: | #38998 [Asn->Csd]: wrong default values in constructor | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1986@lists.php.net to get a copy of this message | ||
ID: 38998
Updated by: danielc@php.net
Reported By: camka at email dot ee
-Status: Assigned
+Status: Closed
Bug Type: Documentation problem
Operating System: win 2000
PHP Version: 5.1.6
Assigned To: georg
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2008-01-12 18:15:23] hholzgra@php.net
Calling the constructor without any argument is like calling
mysqli_init() to create a mysqli object, it does not try to connect at
all in this case but waits for an explicit call to mysqli::connect() or
mysqli::real_connect() which allows to set mysqli::options() before
connecting
Reclassified as documentation bug as the documentation on the mysqli
constructor is not clear about this.
------------------------------------------------------------------------
[2006-10-02 09:09:16] tony2001@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
[2006-10-02 09:04:02] camka at email dot ee
This does not describe, why the first case does not give an error at
all, even if the host is not reachable or does not exist:
$m = mysqli(); // with no parameters
------------------------------------------------------------------------
[2006-10-02 08:54:51] tony2001@php.net
NULL values passed as parameter to mysqli::__construct() have a special
meaning, which are described in the docs.
------------------------------------------------------------------------
[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