xref: /PHP-8.3/ext/oci8/tests/drcp_scope3.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// The test opens a connection within function1 and updates a table
18// (without committing).  Another connection is opened from function
19// 2, and the table queried.  When function1 ends, the connection from
20// function1 is not closed, so the updated value will be seen in
21// function2.  Also the table can't be dropped because an uncommitted
22// transaction exists.
23
24// Create the table
25$c = oci_new_connect($user,$password,$dbase);
26@drcp_drop_table($c);
27drcp_create_table($c);
28
29echo "This is with a OCI_PCONNECT\n";
30function1($user,$password,$dbase);
31
32// Should return the OLD value
33function2($user,$password,$dbase);
34
35// This is the first scope for the script
36
37function function1($user,$password,$dbase)
38{
39    var_dump($c = oci_pconnect($user,$password,$dbase));
40    drcp_update_table($c);
41}
42
43// This is the second scope
44
45function function2($user,$password,$dbase)
46{
47    var_dump($c = oci_pconnect($user,$password,$dbase));
48    drcp_select_value($c);
49}
50
51drcp_drop_table($c);
52oci_close($c);
53
54echo "Done\n";
55
56?>
57--EXPECTF--
58Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s
59This is with a OCI_PCONNECT
60resource(%d) of type (oci8 persistent connection)
61Update done-- DEPT value has been set to NEWDEPT
62resource(%d) of type (oci8 persistent connection)
63The value of DEPT for id 105 is NEWDEPT
64
65Warning: oci_execute(): ORA-00054: %s
66Done
67