php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47064 oo style msqli->connect_error always NULL
Submitted: 2009-01-10 21:13 UTC Modified: 2010-12-20 12:40 UTC
From: greg dot hendrickson at yahoo dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.8 OS: Windows XP SP3
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: greg dot hendrickson at yahoo dot com
New email:
PHP Version: OS:

 

 [2009-01-10 21:13 UTC] greg dot hendrickson at yahoo dot com
Description:
------------
Object oriented style mysqli->connect_error string always null even when a connection error occurs. Tried with bogus host name, bogus user name, bogus password, and bogus schemata...result always the same (mysqli->connect_error is NULL). Note: Procedural style always returns expected string value. 

Installed PHP with Windows Installer, Apache 2.2 Module and the following extensions: BZ2, MCRYPT, MHASH, MYSQLI, PDO, TIDY, XMLRPC, XSL and ZIP.

Reproduce code:
---------------
<?php
$mysqli = new mysqli("bogushost", "username", "password", "schemata");

$connecterror = "Object oriented style mysqli->connect_error string: ".$mysqli->connect_error."</br>";
echo $connecterror;

printf("Proceedural style mysqli_connect_error string: %s\n", mysqli_connect_error()."</br>");

/* check connection never works*/
if ($mysqli->connect_error()) {
	printf("Connect failed: %s\n", mysqli_connect_error()."</br>");
    exit();
}

/* close connection */
$mysqli->close();
?>

Expected result:
----------------
Object oriented style mysqli->connect_error string: Unknown MySQL server host 'bogus' (11001)
Proceedural style mysqli_connect_error string: Unknown MySQL server host 'bogus' (11001)
Connect failed: Unknown MySQL server host 'bogus' (11001)


Actual result:
--------------
Object oriented style mysqli->connect_error string:
Proceedural style mysqli_connect_error string: Unknown MySQL server host 'bogus' (11001)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-10 23:37 UTC] johannes@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

see bug #45940
 [2010-12-20 12:40 UTC] jani@php.net
-Package: Tidy +Package: MySQLi related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 09:01:27 2024 UTC