xref: /PHP-7.3/ext/oci8/tests/drcp_scope4.phpt (revision 4e12fa4a)
1--TEST--
2DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--INI--
6oci8.old_oci_close_semantics=0
7--FILE--
8<?php
9
10require dirname(__FILE__)."/drcp_functions.inc";
11require dirname(__FILE__)."/details.inc";
12
13// The default expected behavior of this test is different between PHP
14// 5.2 and PHP 5.3
15//
16// In PHP 5.3, the test opens a connection within function1 and
17// updates a table (without committing).  Another connection is opened
18// from function 2, and the table queried.  When function1 ends, the
19// txn is rolled back and hence the updated value will not be
20// reflected in function2.  Use oci8.old_oci_close_semantics=1 to
21// get old behavior
22
23// Create the table
24$c = oci_new_connect($user,$password,$dbase);
25@drcp_drop_table($c);
26drcp_create_table($c);
27
28echo "This is with a OCI_PCONNECT\n";
29function1($user,$password,$dbase);
30
31// Should return the OLD value
32function2($user,$password,$dbase);
33
34// This is the first scope for the script
35
36function function1($user,$password,$dbase)
37{
38	var_dump($c = oci_pconnect($user,$password,$dbase));
39	drcp_update_table($c);
40}
41
42// This is the second scope
43
44function function2($user,$password,$dbase)
45{
46	var_dump($c = oci_pconnect($user,$password,$dbase));
47	drcp_select_value($c);
48}
49
50drcp_drop_table($c);
51oci_close($c);
52
53echo "Done\n";
54
55?>
56--EXPECTF--
57This is with a OCI_PCONNECT
58resource(%d) of type (oci8 persistent connection)
59Update done-- DEPT value has been set to NEWDEPT
60resource(%d) of type (oci8 persistent connection)
61The value of DEPT for id 105 is HR
62Done
63