xref: /PHP-8.3/ext/oci8/tests/drcp_scope5.phpt (revision a53e5617)
1--TEST--
2DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--INI--
10oci8.old_oci_close_semantics=1
11--FILE--
12<?php
13
14require __DIR__."/drcp_functions.inc";
15require __DIR__."/details.inc";
16
17// Similar to drcp_scope3.phpt but does a commit before end of
18// function2, allowing the table to be dropped cleanly at the end.
19
20// The test opens a connection within function1 and updates a table
21// (without committing).  Another connection is opened from function
22// 2, and the table queried.  When function1 ends, the connection from
23// function1 is not closed, so the updated value will be seen in
24// function2.  Also the table can't be dropped because an uncommitted
25// transaction exists.
26
27// Create the table
28$c = oci_new_connect($user,$password,$dbase);
29@drcp_drop_table($c);
30drcp_create_table($c);
31
32echo "This is with a OCI_PCONNECT\n";
33function1($user,$password,$dbase);
34
35// Should return the OLD value
36function2($user,$password,$dbase);
37
38// This is the first scope for the script
39
40function function1($user,$password,$dbase)
41{
42    var_dump($c = oci_pconnect($user,$password,$dbase));
43    drcp_update_table($c);
44}
45
46// This is the second scope
47
48function function2($user,$password,$dbase)
49{
50    var_dump($c = oci_pconnect($user,$password,$dbase));
51    drcp_select_value($c);
52    oci_commit($c);
53}
54
55drcp_drop_table($c);
56oci_close($c);
57
58echo "Done\n";
59
60?>
61--EXPECTF--
62Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s
63This is with a OCI_PCONNECT
64resource(%d) of type (oci8 persistent connection)
65Update done-- DEPT value has been set to NEWDEPT
66resource(%d) of type (oci8 persistent connection)
67The value of DEPT for id 105 is NEWDEPT
68Done
69