From:             michael dot virnstein at brodos dot de
Operating system: 
PHP version:      5.2.5
PHP Bug Type:     OCI8 related
Bug description:  cursor not closed after leaving function when selecting lobs

Description:
------------
PHP 5.2.3 / 5.2.4 / 5.2.5
Apache 2.2.6
Oracle-DB 10.2.0.3.0
Oracle-Client 10.2.0.3
OS Linux


Usually, when leaving a function, php closes e.g. statements implicitly.
This works as long as a lob is selected. When a lob is selected, i have to
call oci_free_statement() explicitly on the statement, otherwise the cursor
is kept open and i have a dangling cursor. This issue can cause an
"ORA-01000: maximum open cursors exceeded".

Our db setting for open_cursors is 300, so every session is allowed to
have max 300 cursors open simultaneously. if i run the reproduce code
below, i get an ORA-01000

create the following table:

create table t_lobdata
(
   id number not null,
   data clob
);

fill table:

insert into t_lobdata
select rownum, object_name
  from sys.all_objects;

Reproduce code:
---------------
<?php
 
$conn = ocilogon('user', 'pass', 'db');
 
function getLob($conn, $id)
{
    $result = null;
    $stmt = ociparse($conn, 'select id, data
                               from t_lobdata
                              where id = :id');
    ocibindbyname($stmt, ':id', $id, -1);
    ociexecute($stmt, OCI_DEFAULT);
    ocifetchinto($stmt, $result, OCI_ASSOC+OCI_RETURN_LOBS);
    return $result;
}

for ($id = 1; $id <= 300; $id++) {
    $result = getLob($conn, $id);
}
?>

Expected result:
----------------
cursor gets closed implicitly when leaving the function

Actual result:
--------------
cursor isn't closed, which results in dangling cursors and an ORA-01000

-- 
Edit bug report at http://bugs.php.net/?id=43455&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43455&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43455&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43455&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43455&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43455&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43455&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43455&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43455&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43455&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43455&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43455&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43455&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43455&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43455&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43455&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43455&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43455&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43455&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43455&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43455&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43455&r=mysqlcfg

Reply via email to