From:             greg dot hendrickson at yahoo dot com
Operating system: Windows XP SP3
PHP version:      5.2.8
PHP Bug Type:     MySQLi related
Bug description:  oo style msqli->connect_error always NULL

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 bug report at http://bugs.php.net/?id=47064&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47064&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47064&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47064&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47064&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47064&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47064&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47064&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47064&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47064&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47064&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47064&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47064&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47064&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47064&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47064&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47064&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47064&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47064&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47064&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47064&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47064&r=mysqlcfg

Reply via email to