|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull Requests
Pull requests: HistoryAllCommentsChangesGit/SVN commits              [2017-01-03 11:19 UTC] nikic@php.net
  [2017-01-03 11:19 UTC] nikic@php.net
 
-Status: Open
+Status: Closed
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 03:00:01 2025 UTC | 
Description: ------------ Tested on: PHP 5.6.27-1~dotdeb+7.1 (cli) (built: Oct 15 2016 01:36:00) PHP 7.0.12-1~dotdeb+8.1 (cli) ( NTS ) mysqli_connect_errno() and $mysql->connect_errno are not set at all after a successful persistent connection is re-connected. In the example provided, the 3rd call to "new mysqli" is re-using the connection from the first call, however after the 3rd "new mysqli", mysqli_connect_errno() still returns the error code from the 2nd call, rather than returning 0 for a successful reconnection. This makes it virtually impossible to tell if the 3rd connection succeeded or not for proper application level error handling. Note: This also effects mysqli_connect_error() and $mysqli->connect_error Test script: --------------- $server = 'p:192.168.1.99'; $user = 'USERNAME'; $pass = 'PASSWORD'; $db = 'DATABASE'; $mysql_1 = @new mysqli($server, $user, $pass, $db); var_dump(mysqli_connect_errno()); @$mysql_1->close(); $mysql_2 = @new mysqli('DOESNT-EXIST', $user, $pass, $db); var_dump(mysqli_connect_errno()); @$mysql_2->close(); $mysql_3 = @new mysqli($server, $user, $pass, $db); var_dump(mysqli_connect_errno()); @$mysql_3->close(); Expected result: ---------------- int(0) int(2005) int(0) Actual result: -------------- int(0) int(2005) int(2005)