php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6861 Intermittent Error Message appearing (possible memory leak?)
Submitted: 2000-09-23 08:41 UTC Modified: 2001-04-16 23:05 UTC
From: andy at mindgate dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.2 OS: Win 2000
Private report: No CVE-ID: None
 [2000-09-23 08:41 UTC] andy at mindgate dot net
I get the following ODBC Error:
"Warning: SQL error: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt, SQL state S1000 in SQLExecDirect in 
Sample Source" 

but only if the print statement
before the odbc_exec() calling the stored procedure sp_textcopy is there or if I assign its result to a variable
i.e. $qryid=odbc_exec("sp_textcopy....") (See source below)

The message also appears erratically in another script of mine where i call a preg_replace() and ONLY if I assign the result of the preg_replace to a variable (it can be a dummy variable and have nothing to do with the rest of the script). Moreover, it only happens with preg_replace() and not with preg_match().  The error also disappears(!) if i do an ODD number of strlen($submission) before the odbc_exec() or if i remove the $submission variable from the odbc_exec() string. Also, the stored procedure seems to need to have an EXEC statement before the error will show up and should have a lot of variables passed to it.

In the script below, removing the first <input> tag will also cause the error to disappear. 

All in all nothing seems to make sense, this sort of bug looks suspiciously like a memory leak to me.

My ODBC driver is SQL Server 3.70.08.20


<?php
header("Cache-Control: no-cache, invalidate");
header("Pragma: no-cache");
?>
<html>
<body>
<?php
  if ( $type ) {
    $link=odbc_connect("HEECHEE-ODBC","webpage","");
    odbc_exec($link,"use sampledb");
    odbc_exec($link,"insert into table1 (row2) 
                      values ('dummy')");
    $qryid=odbc_exec($link,"sp_textcopy @srvname 
                            = 'webpage'"); 
    $qryid=odbc_exec($link,"select * from table1");
    print odbc_exec($link,"sp_textcopy @srvname = ''");  
  }
?>
  <form method=POST action="test.php">
  <input type="text" name="type" value="article">
  <input type="submit" value="Upload">
  </form>
</body>
</html>


Transact-SQL Stored Procedure
------- BEGIN -------
CREATE PROCEDURE sp_textcopy (
  @dummy     varchar (30)
) 
AS
EXEC master..xp_cmdshell "dir H:\\winnt\\system32"
-------- END --------



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-26 17:08 UTC] kalowsky@php.net
is this still valid in the current releases?
 [2001-04-16 23:05 UTC] kalowsky@php.net
no feedback from user, considered fixed in the latest cvs... if not, please re-open the bug...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC