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