From:             christopher dot jones at oracle dot com
Operating system: n/a
PHP version:      5.2.1RC4
PHP Bug Type:     OCI8 related
Bug description:  oci_close() has no effect when in a transaction

Description:
------------
The session management differs in some cases when there is an uncommited
transaction.

Run the test case with and without the parse/execute lines commented. 
When the lines are commented out an explicit oci_close() or the end of
f1() causes the connection to be closed.  With the lines active the
sessions remain open and the transactions are not rolled back.

A third error case is if the sample script is changed to use
oci_new_connect(). Confusingly the explict close has no effect but the
end-of-scope will rollback and close the connection.

This may be a in implementation quirk of reference counting but it is a
user level bug.  Oci_close() should always close when
oci8.oci_old_close_semantics has its default value.  The cleanup at
end-of-scope should be consistent regardless of the user transaction
state.

Reproduce code:
---------------
<?php

// Create this table first: create table cj1 (a number);


$v = ini_get('oci8.old_oci_close_semantics');
echo "oci8.old_oci_close_semantics is $v\n";

ociinternaldebug(1);

echo "Test 1\n";

$c1 = oci_new_connect("hr", "hr", "localhost/XE");

echo "Do statement\n";
$s1 = oci_parse($c1, "insert into cj1 values(1)");
var_dump(oci_execute($s1, OCI_DEFAULT));

echo "Before close: transaction should rollback and connection should be
closed\n";

ocilogoff($c1);

echo "After close\n";

echo "Test 2\n";

function f1()
{
    echo "In f1()\n";
    $c2 = oci_new_connect("hr", "hr", "localhost/XE");

    if (!$c2) {
        $m = ocierror();
        echo $m['message'];
        exit;
    }
    else {
        echo "Connection succeeded\n";
    }

    echo "Do statement\n";
    $s2 = oci_parse($c2, "insert into cj1 values(1)"); 
    var_dump(oci_execute($s2, OCI_DEFAULT));

    echo "Before end of scope\n";
}

f1();
echo "after f1() call - end of scope\n";

echo "End of script\n";

?>



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

Reply via email to