php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #729 mysql_connect reuses connection ids
Submitted: 1998-09-09 02:02 UTC Modified: 2001-02-10 12:27 UTC
From: walton at nordicdms dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.3 OS: FreeBSD 2.2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: walton at nordicdms dot com
New email:
PHP Version: OS:

 

 [1998-09-09 02:02 UTC] walton at nordicdms dot com
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-10 12:27 UTC] jimw@php.net
i'm pretty sure this was fixed in 4.0.
 [2022-12-08 12:51 UTC] git@php.net
Automatic comment on behalf of saundefined
Revision: https://github.com/php/web-php/commit/e8fde3b8cb5e4ca51013d035612b989d0eaa43ee
Log: Fix PHP 8.2.0 date
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 23:01:30 2024 UTC