From:             [EMAIL PROTECTED]
Operating system: Linux-i386
PHP version:      4.0.6
PHP Bug Type:     MySQL related
Bug description:  MySQL changes the link to localhost when not needed.

We have a PHP script that suddenly changes its connection to a MySQL DB to
the MySQL DB the localhost has. It wasn't suppose to do so. It happened
after we created a new connection and then closed this new connection to
use the old connection. The problem is that PHP now tries to connect to
localhost, instead of using the only connection available. If it succeeds,
it will connect to a host that could have nothing to do with the
application (imagine a MySQL master-slave environment and the application
is suppose to connect to the Master and, instead, it connects to the
localhost where there's a slave and start updating data. This will corrupt
the slave machine, which is what happened to us)

<?
$conn = mysql_connect("somehost", "user", "passwd");

echo mysql_get_host_info(), "<br>";

$conn2 = mysql_connect("anotherhost", "anotheruser", "anotherpasswd");
mysql_close($conn2);

echo mysql_get_host_info(), "<br>";

?>

Ain't it a good reason for a review in this part of the code?
-- 
Edit bug report at: http://bugs.php.net/?id=14279&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to