php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67799 mssql_close($link) doesn't seem to close the $link
Submitted: 2014-08-06 16:23 UTC Modified: 2016-10-15 23:18 UTC
From: maferra at isq dot pt Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: Irrelevant OS: SunOS 5.11 11.1 i86pc
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-08-06 16:23 UTC] maferra at isq dot pt
Description:
------------
I'm using PHP 5.3.14, but I believe that the mssql extension has not been updated for a while.

Description: mssql_close($link) doesn't seem to close the $link (and perhaps NULL the $link variable), but mssql_close() does close the last opened link. In the test script I have made an example.

Test script:
---------------
MSSQL_SERVERNAME, MSSQL_USERNAME, MSSQL_PASSWORD are constants with the real parameters.

Example (it works):
===================

Code:

var_dump(mssql_connect(MSSQL_SERVERNAME, MSSQL_USERNAME, MSSQL_PASSWORD));

var_dump(mssql_close());

$f = mssql_fetch_assoc(mssql_query("select getdate();"));

var_dump($f);

Output:

resource(2) of type (mssql link)
bool(true)
NULL

Example (it doesn't work as expected):
======================================

Code:

var_dump($c = mssql_connect(MSSQL_SERVERNAME, MSSQL_USERNAME, MSSQL_PASSWORD));

var_dump(mssql_close($c));

$f = mssql_fetch_assoc(mssql_query("select getdate();", $c));

var_dump($f);

Output:

resource(2) of type (mssql link)
bool(true)
array(1) {
  'computed' =>
  string(26) "Aug  6 2014 05:18:37:883PM"
}

I believe that it shouldn't have made the query (in fact, mssql_close($c) has returned true, so the link should be closed).

Can I give you further further information?

Best regards,


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-15 23:18 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:18 UTC] kalle@php.net
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC