ID:               47935
 User updated by:  patomas at hotmail dot com
 Reported By:      patomas at hotmail dot com
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Linux (Gentoo)
 PHP Version:      5.2.9
 New Comment:

Hi

Thank you for your answer, but it still doesn't seem to be clear to me,
can you point to the right documentation?.

Because, checking the documentation in
http://us3.php.net/manual/en/function.mysql-connect.php you can read as
follows:

[quote]
Return Values

Returns a MySQL link identifier on success, or FALSE on failure.
[/quote]

I may be wrong, but I think it is normal to expect a failure if you use
false as a value for any of the connection parameters. First because if
they are constants, it will depend on the value of each word, but if in
any case, they fail, it is a failure. In the other hand, 'false' is a
language constant with a predefined value, easily recognizable so we are
passing something like 'no atribute' or 'incorrect atribute' to the
connection.

If you try something like that in mysql console, in mysql-administrator
or in any other interface, you get a Could not connect to host 'false'
and MySQL Error Nr. 2005. Which in my mind and to my eyes, not to
mention to mysql, looks like an error and the final result is that no
connection is stablished.

So if this is not a failure, Can you, please, explain more detailed
what is a failure in a command that should connect to a database?

References:
http://us3.php.net/manual/en/reserved.constants.php
http://us3.php.net/manual/en/language.types.boolean.php
http://us3.php.net/manual/en/function.mysql-connect.php
http://dev.mysql.com/doc/refman/5.1/en/error-messages-client.html


Previous Comments:
------------------------------------------------------------------------

[2009-04-09 13:20:40] il...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It logs in anonymously then, which in your case is apparently allowed.

------------------------------------------------------------------------

[2009-04-09 11:00:54] patomas at hotmail dot com

Description:
------------
Hi

If you try to connect to a database with mysql_connect( false, false,
false ), the connection fails, but the command still generates a
resource. I think that false would be a more accurate response since it
can not stablish a real connection.

My php version is 5.2.8 but i couldn't choose it in the menu and I
can't upgrade now.

Reproduce code:
---------------
var_dump( mysql_connect( false, false, false ) );

Expected result:
----------------
boolean false

Actual result:
--------------
resource(25, mysql link)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47935&edit=1

Reply via email to