PHP  
 PHP_HEAD
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

==26159== Invalid read of size 1
==26159==    at 0xA96B1E: zval_get_type (zend_types.h:390)
==26159==    by 0xA96B1E: php_oci_register_taf_callback (oci8_failover.c:108)
==26159==    by 0xA96AD7: php_oci_unregister_taf_callback (oci8_failover.c:92)
==26159==    by 0xA91959: zif_oci_close (oci8_interface.c:1620)
==26159==    by 0x11BD4EB: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:573)
==26159==    by 0x1339863: execute_ex (zend_vm_execute.h:59726)
==26159==    by 0x1339EDB: zend_execute (zend_vm_execute.h:63763)
==26159==    by 0x10DF02D: zend_execute_scripts (zend.c:1494)
==26159==    by 0xFD0CE5: php_execute_script (main.c:2566)
==26159==    by 0x133FA79: do_cli (php_cli.c:1011)
==26159==    by 0x134142D: main (php_cli.c:1404)
==26159==  Address 0x1510e078 is 136 bytes inside a block of size 144 free'd
==26159==    at 0x4C28BD4: free (vg_replace_malloc.c:529)
==26159==    by 0x1076214: _efree (zend_alloc.c:2428)
==26159==    by 0xA6B758: php_oci_connection_close (oci8.c:2267)
==26159==    by 0xA6517B: php_oci_connection_list_dtor (oci8.c:1266)
==26159==    by 0x1120A31: zend_resource_dtor (zend_list.c:76)
==26159==    by 0x1120B09: zend_list_close (zend_list.c:89)
==26159==    by 0xA9193B: zif_oci_close (oci8_interface.c:1617)
==26159==    by 0x11BD4EB: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:573)
==26159==    by 0x1339863: execute_ex (zend_vm_execute.h:59726)
==26159==    by 0x1339EDB: zend_execute (zend_vm_execute.h:63763)
==26159==    by 0x10DF02D: zend_execute_scripts (zend.c:1494)
==26159==    by 0xFD0CE5: php_execute_script (main.c:2566)
==26159==  Block was alloc'd at
==26159==    at 0x4C291FA: malloc (vg_replace_malloc.c:298)
==26159==    by 0x10777DB: __zend_malloc (zend_alloc.c:2811)
==26159==    by 0x1075EF1: _emalloc (zend_alloc.c:2413)
==26159==    by 0x107677F: _safe_emalloc (zend_alloc.c:2472)
==26159==    by 0x1076B91: _ecalloc (zend_alloc.c:2495)
==26159==    by 0xA69EF6: php_oci_do_connect_ex (oci8.c:1981)
==26159==    by 0xA66680: php_oci_do_connect (oci8.c:1645)
==26159==    by 0xA91A11: zif_oci_connect (oci8_interface.c:1640)
==26159==    by 0x11BD9D3: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:617)
==26159==    by 0x1339863: execute_ex (zend_vm_execute.h:59726)
==26159==    by 0x1339EDB: zend_execute (zend_vm_execute.h:63763)
==26159==    by 0x10DF02D: zend_execute_scripts (zend.c:1494)
==26159== 

 

Generated at Sat, 09 Sep 2017 03:10:54 +0000 (14 days ago)

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