#47064 [Opn->Bgs]: oo style msqli->connect_error always NULL

From: Date: Sat, 10 Jan 2009 23:37:36 +0000
Subject: #47064 [Opn->Bgs]: oo style msqli->connect_error always NULL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132732@lists.php.net to get a copy of this message
ID: 47064 Updated by: johannes@php.net Reported By: greg dot hendrickson at yahoo dot com -Status: Open +Status: Bogus Bug Type: MySQLi related Operating System: Windows XP SP3 PHP Version: 5.2.8 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2009-01-10 21:13:04] 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) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47064&edit=1

« previous php.bugs (#132732) next »