|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-10 23:37 UTC] johannes@php.net
[2010-12-20 12:40 UTC] jani@php.net
-Package: Tidy
+Package: MySQLi related
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 23:00:01 2025 UTC |
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)