PHP  
 PHP_7_0
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for ext/oci8/tests/edition_2.phpt ('Set and check Oracle 11gR2 "edition" attribute')

Script

1: <?php
2:
3:
/* In 11.2, there can only be one child edition.  So this test will
4:  * fail to create the necessary editions if a child edition exists
5:  * already
6:  */
7:
8:
$testuser     'testuser_ed_2';  // Used in conn_attr.inc
9:
$testpassword 'testuser'
10:
11: require(
dirname(__FILE__)."/conn_attr.inc");
12:
13: echo
"**Test 1.1 - Default value for  the attribute **************\n";
14:
get_edit_attr($c);
15:
16: echo
"\n\n**Test 1.2 - Set a value and get the same with different connections *********\n";
17:
set_edit_attr('MYEDITION');
18:
19:
// With oci_connect, oci_pconnect, oci_new_connect
20:
$conn1 get_conn(1);
21:
get_edit_attr($conn1);
22:
23:
//pconnect
24:
$conn2 get_conn(2);
25:
get_edit_attr($conn2);
26:
27:
//new_connect
28:
$conn3 get_conn(3);
29:
get_edit_attr($conn3);
30:
31:
oci_close($conn1);
32:
33:
// With a oci_pconnect with a different charset.
34:
$pc1 oci_pconnect($testuser,$testpassword,$dbase,"utf8");
35:
get_edit_attr($pc1);
36:
oci_close($pc1);
37:
38:
39: echo
"\n\n**Test 1.3 change the value and verify with existing conenctions.*********\n";
40:
set_edit_attr('MYEDITION1');
41:
get_edit_attr($conn2);
42:
get_edit_attr($conn3); // Old value
43:
oci_close($conn2);
44:
oci_close($conn3);
45:
46:
//open a new connection and get the edition value . This will have the updated value.
47:
$c3 get_conn(3); //oci_new_connect()
48:
get_edit_attr($c3);
49:
50:
$c4 get_conn(2); //oci_pconnect()
51:
get_edit_attr($c4);
52:
53:
$c5 get_conn(1); //oci_connect()
54:
get_edit_attr($c5);
55:
56:
oci_close($c3);
57:
oci_close($c4);
58:
oci_close($c5);
59:
60: echo 
"\n\n**Test 1.4 - with different type of values *********\n";
61:
$values_array = array(123,NULL,'NO EDITION','edition name which has more than thirty chars!!!edition name which has more than thirty chars!!!');
62: foreach (
$values_array as $val ) {
63:     
set_edit_attr($val);
64:     
$c1 get_conn(1); //oci_connect()
65:     
if ($c1) {
66:         
get_edit_attr($c1);
67:         
oci_close($c1);
68:     }    
69: }
70:
71: echo 
"\n\n**Test 1.5 - Negative case with an invalid string value. *********\n";
72:
$c1 get_conn(3);
73:
$r set_edit_attr($c1);
74:
75: echo
"\n\n**Test 1.6 - Set Multiple times.*****\n";
76:
set_edit_attr('MYEDITION');
77:
set_edit_attr('MYEDITION1');
78:
$c1 get_conn(1);
79:
get_edit_attr($c1);
80:
oci_close($c1);
81:
82: echo 
"\n\n**Test 1.7 - Test with ALTER SESSION statement to change the edition *******\n";
83:
// Set the edition value to MYEDITION. open a conn .get the value.
84: // execute the alter system set edition ='MYEDITION' .get the value .
85: // set it back to MYEDITION using oci_set_edition. and get the value.
86:
87:
set_edit_attr('MYEDITION');
88:
$c1 get_conn(3);
89: echo 
"get the value set to MYEDITION with oci_set_edition \n";
90:
get_edit_attr($c1);
91:
92:
$alter_stmt "alter session set edition = MYEDITION1";
93:
$s oci_parse($c1,$alter_stmt);
94:
oci_execute($s);
95:
oci_commit($c1);
96: echo 
"Get the value set to MYEDITION1 with alter session\n";
97:
get_edit_attr($c1);
98:
99: echo 
" Get the value with a new connection \n";
100:
$c2 get_conn(1);
101:
get_edit_attr($c2);
102:
103: echo 
" Set the value back using oci-set_edition\n";
104:
set_edit_attr('MYEDITION');
105:
get_edit_attr($c2);
106:
107: echo 
" Get the value with a new conenction \n";
108:
$c3 get_conn(1);
109:
get_edit_attr($c3);
110:
111:
oci_close($c1);
112:
oci_close($c2);
113:
oci_close($c3);
114:
115:
116: echo 
"\n\n**Test 1.8 - Test setting the attribute with scope ends*******\n";
117:
set_scope();
118:
get_scope();
119:
120:
clean_up($c);
121: echo 
"Done\n";
122:
123:
124: function 
set_scope() {
125:     
$r set_edit_attr('MYEDITION1');
126: }
127:
128: function 
get_scope() {
129:     
$sc1 oci_connect($GLOBALS['testuser'],$GLOBALS['testpassword'],$GLOBALS['dbase']);
130:     if (
$sc1 === false) {
131:         
$m oci_error();
132:         die(
"Error:" $m['message']);
133:     }
134:     
get_edit_attr($sc1);
135:     
oci_close($sc1);
136: }
137:
?>
138:

Report

==31122== Invalid read of size 1
==31122==    at 0xA1E9C6: zval_get_type (zend_types.h:327)
==31122==    by 0xA1E9C6: php_oci_register_taf_callback (oci8_failover.c:108)
==31122==    by 0xA1E97F: php_oci_unregister_taf_callback (oci8_failover.c:92)
==31122==    by 0xA1998D: zif_oci_close (oci8_interface.c:1620)
==31122==    by 0x1092F2A: ZEND_DO_ICALL_SPEC_HANDLER (zend_vm_execute.h:586)
==31122==    by 0x1090CFD: execute_ex (zend_vm_execute.h:417)
==31122==    by 0x1091923: zend_execute (zend_vm_execute.h:458)
==31122==    by 0xFC3656: zend_execute_scripts (zend.c:1443)
==31122==    by 0xEC11C4: php_execute_script (main.c:2493)
==31122==    by 0x11C5E29: do_cli (php_cli.c:977)
==31122==    by 0x11C77B9: main (php_cli.c:1347)
==31122==  Address 0x15185348 is 136 bytes inside a block of size 144 free'd
==31122==    at 0x4C28BD4: free (vg_replace_malloc.c:529)
==31122==    by 0xF643C0: _efree (zend_alloc.c:2472)
==31122==    by 0x9F3CAF: php_oci_connection_close (oci8.c:2267)
==31122==    by 0x9ED7DB: php_oci_connection_list_dtor (oci8.c:1266)
==31122==    by 0x10033C9: zend_resource_dtor (zend_list.c:76)
==31122==    by 0x10034A1: zend_list_close (zend_list.c:89)
==31122==    by 0xA1996F: zif_oci_close (oci8_interface.c:1617)
==31122==    by 0x1092F2A: ZEND_DO_ICALL_SPEC_HANDLER (zend_vm_execute.h:586)
==31122==    by 0x1090CFD: execute_ex (zend_vm_execute.h:417)
==31122==    by 0x1091923: zend_execute (zend_vm_execute.h:458)
==31122==    by 0xFC3656: zend_execute_scripts (zend.c:1443)
==31122==    by 0xEC11C4: php_execute_script (main.c:2493)
==31122==  Block was alloc'd at
==31122==    at 0x4C291FA: malloc (vg_replace_malloc.c:298)
==31122==    by 0xF65A20: __zend_malloc (zend_alloc.c:2864)
==31122==    by 0xF6409D: _emalloc (zend_alloc.c:2457)
==31122==    by 0xF6492B: _safe_emalloc (zend_alloc.c:2516)
==31122==    by 0xF64D3D: _ecalloc (zend_alloc.c:2539)
==31122==    by 0x9F244D: php_oci_do_connect_ex (oci8.c:1981)
==31122==    by 0x9EECE0: php_oci_do_connect (oci8.c:1645)
==31122==    by 0xA19A45: zif_oci_connect (oci8_interface.c:1640)
==31122==    by 0x1092F2A: ZEND_DO_ICALL_SPEC_HANDLER (zend_vm_execute.h:586)
==31122==    by 0x1090CFD: execute_ex (zend_vm_execute.h:417)
==31122==    by 0x1091923: zend_execute (zend_vm_execute.h:458)
==31122==    by 0xFC3656: zend_execute_scripts (zend.c:1443)
==31122== 

 

Generated at Wed, 20 Sep 2017 13:49:37 +0000 (3 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.