xref: /PHP-8.3/ext/oci8/tests/drcp_scope4.phpt (revision a53e5617)
1--TEST--
2DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--INI--
10oci8.old_oci_close_semantics=0
11--FILE--
12<?php
13
14require __DIR__."/drcp_functions.inc";
15require __DIR__."/details.inc";
16
17// The default expected behavior of this test is different between PHP
18// 5.2 and PHP 5.3
19//
20// In PHP 5.3, the test opens a connection within function1 and
21// updates a table (without committing).  Another connection is opened
22// from function 2, and the table queried.  When function1 ends, the
23// txn is rolled back and hence the updated value will not be
24// reflected in function2.  Use oci8.old_oci_close_semantics=1 to
25// get old behavior
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}
53
54drcp_drop_table($c);
55oci_close($c);
56
57echo "Done\n";
58
59?>
60--EXPECTF--
61This is with a OCI_PCONNECT
62resource(%d) of type (oci8 persistent connection)
63Update done-- DEPT value has been set to NEWDEPT
64resource(%d) of type (oci8 persistent connection)
65The value of DEPT for id 105 is HR
66Done
67