|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-12 17:45 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 05:00:01 2025 UTC |
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"; ?>