Bug #729: mysql_connect reuses connection ids
| From: | walton at nordicdms dot com | Date: | Wed, 09 Sep 1998 06:02:52 +0000 |
| Subject: | Bug #729: mysql_connect reuses connection ids | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-880@lists.php.net to get a copy of this message | ||
From: walton@nordicdms.com
Operating system: FreeBSD 2.2.6
PHP version: 3.0.3
PHP Bug Type: MySQL related
Bug description:
This can cause unpleasant problems when using a library function that cleans up after itself.
The script:
<?
function some_reuseable_function() {
// Pretend this function was included from another file
$conn2 = mysql_connect('host', 'uid', 'pwd');
echo "Function connection is: $conn2<br>\n";
mysql_close($conn2);
}
$conn1 = mysql_connect('host', 'uid', 'pwd');
echo "Main connection is: $conn1<br>\n";
some_reuseable_function();
mysql_close($conn1);
?>
The output:
Main connection is: 1
Function connection is: 1
Warning: 1 is not a MySQL link index in test.php3 on line 12
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net