#31094 [Opn->Csd]: mysqli_connect() does not accept socket=false
| From: | oliver at realtsp dot com | Date: | Sun, 19 Dec 2004 08:16:17 +0000 |
| Subject: | #31094 [Opn->Csd]: mysqli_connect() does not accept socket=false | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70622@lists.php.net to get a copy of this message | ||
ID: 31094
User updated by: oliver at realtsp dot com
Reported By: oliver at realtsp dot com
-Status: Open
+Status: Closed
Bug Type: MySQLi related
Operating System: FreeBSD 5.3-RELEASE
PHP Version: 5.0.2
New Comment:
just tested with php-5.0.3. one of the bug fixes in this release,
although it it not clear to me from the changelog, has fixed the bug
also.
guess it is was worthwhile to record this here for people stuck on
5.0.3
thanks
Previous Comments:
------------------------------------------------------------------------
[2004-12-14 19:27:25] oliver at realtsp dot com
Description:
------------
mysqli_connect() no longer accepts false/null for the socket parameter.
It interprets it as an empty string and as a result fails to find the
socket and therefore connect.
Previous versions used to ignore false/null and just use the hostname
etc to connect.
The reason I am not just changing the call to
$db = mysqli_connect($host, $username, $password, $database);
is because this code is from PEAR::DB and this change would be quite
major. See my bug:
http://pear.php.net/bugs/bug.php?id=2960
as danielc points out: "most PHP functions gladly
accept false/null for optional string arguments without causing
problems"
Reproduce code:
---------------
<?php
$db = mysqli_connect($host, $username, $password, $database, null,
null);
?>
same result with
<?php
$db = mysqli_connect($host, $username, $password, $database, false,
false);
?>
Expected result:
----------------
a valid connection
Actual result:
--------------
following error:
Can't connect to local MySQL server through socket '' (2)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31094&edit=1