php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76151 Mention false return value on mysqli_connect failure
Submitted: 2018-03-26 15:16 UTC Modified: 2018-03-26 18:09 UTC
From: phpbugs at personal dot formauri dot es Assigned:
Status: Open Package: MySQLi related
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-03-26 15:16 UTC] phpbugs at personal dot formauri dot es
Description:
------------
When mysqli::__construct fails to connect, the return value is boolean false, but this is not mentioned in the documentation.

Affected page: http://php.net/manual/en/mysqli.construct.php


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-26 15:49 UTC] danack@php.net
Please could you provide a reproduce case, just to make adding a test be trivial.


I think this behaviour is a bug since this RFC was passed: https://wiki.php.net/rfc/internal_constructor_behaviour
 [2018-03-26 15:50 UTC] cmb@php.net
-Package: Documentation problem +Package: MySQLi related
 [2018-03-26 15:52 UTC] requinix@php.net
-Summary: Mention false return value on mysqli::__construct failure +Summary: Mention false return value on mysqli_connect failure
 [2018-03-26 15:52 UTC] requinix@php.net
I believe phpbugs means the mysqli_connect function.
 [2018-03-26 16:46 UTC] phpbugs at personal dot formauri dot es
Yes, my apologies. I was testing with mysqli_connect() and I believed the manual when it said that it was an alias of mysqli::__construct().

So I guess that mysqli_connect() should have a separate documentation if it handles the return value differently.
 [2018-03-26 18:09 UTC] requinix@php.net
mysqli_connect and mysqli::__construct are the same thing internally so it is good for them to share documentation. Some other classes are in the same situation too, like DateTime. Including the return value is fine.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 23 05:01:26 2019 UTC