ID: 40588 User updated by: frankpw at fw2s dot com Reported By: frankpw at fw2s dot com Status: Bogus Bug Type: MySQLi related Operating System: Win XP Pro PHP Version: 5.2.1 New Comment:
As promised I'm not attempting to continue, therfore I didn't change status to open. And you don't have to answer this. It would be much easier for me to accept a statement: "I like it the way it is so don't bother to report this as an error.". It doesn't matter if mysqli_connect() attempts a connection or not. This attempt is made by a developer, programmer or whoever is using this function, and, according to documentation, expecting to get a promised response - if connection was made then no error, if connection wasn't made, then error is being reported, like any other. If your arguments are valid then why do we need error handling at all. I think we are from totally different schools of logic. Your logic allows three values: false, true, and something in between. Best regards, Frank P. Walentynowicz Previous Comments: ------------------------------------------------------------------------ [2007-02-22 20:27:40] [EMAIL PROTECTED] That's easy - "3306" and "10" are numeric strings, but "abcd" is not. >Isn't it logical to assume that if connection fails That's the point. Connection doesn't fail. The function is called with wrong parameters, so it doesn't even _try_ to connect, because we already know the parameters are wrong. You can see the same with mysqli_connect() without any parameters. ------------------------------------------------------------------------ [2007-02-22 20:19:25] frankpw at fw2s dot com I promise to end this discussion if you tell me that passing port number as "3306" or "10" (notice quotes) is correct. Port is declared as int not a string. With above values "3306" will make connection (assuming that server is set to listen on port 3306) and with "10" will fail with proper values returned by mysqli_connect_errno and mysqli_connect_error. Isn't it logical to assume that if connection fails (for whatever reason) this reason should be consistently stated in responses from mysqli_connect_errno() and mysqli_connect_error()? ------------------------------------------------------------------------ [2007-02-22 19:55:18] [EMAIL PROTECTED] >This check fails in this particular case This check should be used when you pass correct parameters to the function. >Are you insisting that this is not connection error and >that it shoud be handled differently? Yes, I do. You're passing wrong parameters to the function. ------------------------------------------------------------------------ [2007-02-22 19:42:42] frankpw at fw2s dot com That is not a point. Even the manual shows how connection errors should be handled: /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } This check fails in this particular case because mysqli_connect_error() is empty and mysqli_connect_errno is 0. Are you insisting that this is not connection error and that it shoud be handled differently? ------------------------------------------------------------------------ [2007-02-22 19:02:51] [EMAIL PROTECTED] Remove the @, you'll see the error. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40588 -- Edit this bug report at http://bugs.php.net/?id=40588&edit=1