From:             cjbj at hotmail dot com
Operating system: Windows 2000
PHP version:      4.3.7
PHP Bug Type:     OCI8 related
Bug description:  Multiple logons cause handles to become invalid

Description:
------------
Multiple logons within the same request cause handles to become invalid
and queries to fail.  

Also see:
http://forums.oracle.com/forums/thread.jsp?forum=178&thread=251141

To reproduce, restart Apache and run the following file.

The same incorrect output occurs with ocilogon() inplace of ocinlogon().


Reproduce code:
---------------
  <?php
  ociinternaldebug(1);

  function qry(&$c, $s) {
      echo "<br>===&gt;BEGIN<br><br>";
      $rSth = OCIParse($c, $s);
      $rRet = OCIExecute($rSth);
      echo "<br>";
      while ($succ = OCIFetchInto($rSth, $row)) {
        foreach ($row as $item) {
          echo ($item?htmlentities($item):'&nbsp;')." ";
        }
        echo "<br>\n";
      }
      echo "<br>===&gt;CLOSE<br><br>";
      ocifreestatement($rSth);
  }

  $statement1 = "select dname from dept";
  $statement2 = "select user from dual;";

  echo "<br>===&gt;OCINLogin #1<br><br>";
  $c1 = OCINlogon('scott', 'tiger', 'MYDB' );

  echo "<br>===&gt;Query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;OCINLogin #2<br><br>";
  $c2 = OCINlogon('hr', 'hr', 'MYDB');

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement2);

  ?>


Expected result:
----------------
Three queries are successfully completed.

Actual result:
--------------
  ===>OCINLogin #1

  OCIDebug: _oci_open_server new conn=0 dname=MYDB
  OCIDebug: _oci_open_session new sess=3 user=scott
  OCIDebug: oci_do_connect: id=4

  ===>Query first connection
  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=5 conn=4

  ACCOUNTING
  RESEARCH
  SALES
  OPERATIONS

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=5 last_query="select dname from
dept"
  OCIDebug: START _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_stmt_list_dtor: id=5

  ===>OCINLogin #2

  OCIDebug: _oci_open_session new sess=6 user=hr
  OCIDebug: oci_do_connect: id=7

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=8 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00942: table or view does not
exist in c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done before
fetch or execute and fetch in c:\cj\php\cj\contest.php on line 15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=8 last_query="select dname from
dept"
  OCIDebug: END _oci_stmt_list_dtor: id=8

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select user from dual;" id=9 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00911: invalid character in
c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done before
fetch or execute and fetch in c:\cj\php\cj\contest.php on line 15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=9 last_query="select user from
dual;"
  OCIDebug: END _oci_stmt_list_dtor: id=9
  OCIDebug: START php_rshutdown_oci
  OCIDebug: END php_rshutdown_oci
  OCIDebug: START _oci_conn_list_dtor: id=4
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=3
  OCIDebug: END _oci_conn_list_dtor: id=4
  OCIDebug: START _oci_conn_list_dtor: id=7
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=6
  OCIDebug: END _oci_conn_list_dtor: id=7
  OCIDebug: START _oci_close_server: detaching conn=2 dbname=MYDB


-- 
Edit bug report at http://bugs.php.net/?id=29013&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29013&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29013&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29013&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29013&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29013&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29013&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29013&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29013&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29013&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29013&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29013&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29013&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29013&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29013&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29013&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29013&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29013&r=float

Reply via email to