php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31094 mysqli_connect() does not accept socket=false
Submitted: 2004-12-14 19:27 UTC Modified: 2004-12-19 09:16 UTC
From: oliver at realtsp dot com Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5.0.2 OS: FreeBSD 5.3-RELEASE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oliver at realtsp dot com
New email:
PHP Version: OS:

 

 [2004-12-14 19:27 UTC] 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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-19 09:16 UTC] oliver at realtsp dot com
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
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Nov 19 10:01:25 2018 UTC