From:             Nico dot Laus dot 2001 at gmx dot de
Operating system: Linux 2.6.8.1
PHP version:      5.0.1
PHP Bug Type:     MySQLi related
Bug description:  connecting to MySQL with wrong data cannot be checked with 
mysqli_connect()

Description:
------------
given the example below from the mysqli documentation, I 
tried to connect to my MySQL server with wrong data to 
see, what happens, if the connection really fails. 
 
unfortunately the constructor does trigger a WARNING 
itself and does not return FALSE, as documented. The 
mysqli_connect_errno() does only return 0 and even the 
$mysqli->errno variable does not have any value. So I 
cannot find out, if the connect really has failed or not. 
 
I'm using MySQL 4.1.4 

Reproduce code:
---------------
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
 
 /* check connection */ 
 if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
 }

Expected result:
----------------
Connect failed: <error> 

Actual result:
--------------
 

-- 
Edit bug report at http://bugs.php.net/?id=30051&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30051&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30051&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30051&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30051&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30051&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30051&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30051&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30051&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30051&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30051&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30051&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30051&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30051&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30051&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30051&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30051&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30051&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30051&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30051&r=mysqlcfg

Reply via email to