Bug #14478: mutliple calls to mysql_[p]connect() with same arguments return same resourceID
| From: | shawn at trnsplnt dot com | Date: | Thu, 13 Dec 2001 02:21:01 +0000 |
| Subject: | Bug #14478: mutliple calls to mysql_[p]connect() with same arguments return same resourceID | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-73452@lists.php.net to get a copy of this message | ||
From: shawn@trnsplnt.com
Operating system: FreeBSD
PHP version: 4.0.6
PHP Bug Type: MySQL related
Bug description: mutliple calls to mysql_[p]connect() with same arguments return same resourceID
I've noticed what appears to be a bug in the
mysql_connect() and mysql_pconnect() (or perhaps the mysql
client libraries): multiple calls to either function with
identical arguments return the same resource id, preventing
me from connecting to multiple databases on the same host,
with the same credentials. Example:
<?php
$conn1 = mysql_connect('host','username','pass');
$conn2 = mysql_connect('host','username','pass');
echo "conn1: $conn1\n";
echo "conn2: $conn2\n";
?>
Produces:
conn1: Resource id #1
conn2: Resource id #1
If I then issue a call to mysql_select_db('foo',$conn1),
'foo' also becomes the active database on $conn2 since the
handles point to the same resource. Doesn't this contradict
the idea of having separate connection handles? Or is it a
short-coming of the client libraries?
Thanks!
--
Edit bug report at: http://bugs.php.net/?id=14478&edit=1