ID: 9272
Updated by: kalowsky
Old-Status: Open
Status: Closed
Bug Type: ODBC related
Assigned To: 

patch applied... 

Previous Comments:

[2001-02-15 05:35:13] [EMAIL PROTECTED]
If I open a persistent odbc connection and close it later I
get a warning even though the function works correctly.

The following script reproduces this:
  $odbchandle = odbc_pconnect($dbname, "", "");
  echo odbc_tables($odbchandle) . "<br>";
  echo odbc_close($odbchandle) . "<br>";
  Warning: Supplied resource is not a valid ODBC-Link
  resource in f:homedbxhtmldbx.php on line XXX

If I use odbc_connect in the same script it all works ok.

In the odbc source code I traced this to the following lines from php_odbc.c, in 

  conn = (odbc_connection *) zend_fetch_resource(pv_conn,
         -1, "ODBC-Link", NULL, 1, le_conn);
    ZEND_FETCH_RESOURCE(conn, odbc_connection *, pv_conn,
         -1, "ODBC-Link", le_pconn);
    is_pconn = 1;

As you can see the first line will issue the warning, and if it fails it detects that 
it might be a persistent connection and continues correctly.

A replacement patch for these lines might be

  int found_resource_type = le_conn;
  conn = (odbc_connection *) zend_fetch_resource(pv_conn,
         -1, "ODBC-Link", &found_resource_type, 
         2, le_conn, le_pconn);
  if (found_resource_type==le_pconn) {
    is_pconn = 1;

but I don't know how to submit a patch/diff so here it is.

Cheerio, Marc.


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to