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

Test Failure Report for ext/oci8/tests/bug71148.phpt ('Bug #71448 (Binding reference overwritten on php7)')

Script

1: <?php
2:
3:
require(dirname(__FILE__).'/connect.inc');
4:
5:
// Initialize
6:
7:
$stmtarray = array(
8:     
"CREATE OR REPLACE FUNCTION bindfunc(var1 varchar2, var2 varchar2)
9:        RETURN varchar2
10:        AS var3 VARCHAR2(20);
11:        BEGIN
12:          var3 := CONCAT(var1, var2);
13:          RETURN var3;
14:        END;"
,
15:     
"CREATE OR REPLACE PROCEDURE bindproc(var1 IN string, var2 IN string, var3 IN OUT string) IS
16:        BEGIN
17:          var3 := CONCAT(var1, var3);
18:          var3 := CONCAT(var3, var2);
19:        END;"
20:
);
21:
22:
oci8_test_sql_execute($c$stmtarray);
23:
24:
// Run test
25:
26:
function bindvar($stmt$name$var)
27: {
28:   
oci_bind_by_name($stmt$name$var);
29: }
30:
31:
// Test 1: Bind input parameter in a local function
32:
$sql "select :var1, :var2 from dual";
33:
$cache1 "INSTR1";
34:
$cache2 "INSTR2";
35:
36: echo 
"Test 1: Bind input parameter in a local function\n";
37:
$stmt oci_parse($c$sql);
38:
39:
bindvar($stmt':var1'$cache1);
40:
bindvar($stmt':var2'$cache2);
41:
42:
oci_execute($stmt);
43:
44:
var_dump(oci_fetch_assoc($stmt));
45:
46:
oci_free_statement($stmt);
47:
48:
// Test 2: Bind output parameter in a local function
49:
$sql "begin :output1 := 'OUTSTR1'; :output2 := 'OUTSTR2'; end;";
50:
$cache1 "xxxxxx";
51:
$cache2 "xxxxxx";
52:
53: echo 
"\nTest 2: Bind output parameter in a local function\n";
54:
$stmt oci_parse($c$sql);
55:
56:
bindvar($stmt':output1'$cache1);
57:
bindvar($stmt':output2'$cache2);
58:
59:
oci_execute($stmt);
60:
61:
var_dump($cache1);
62:
var_dump($cache2);
63:
64:
oci_free_statement($stmt);
65:
66:
// Test 3: Bind output parameter within the same scope of execute
67:
$sql "begin :output1 := 'OUTSTR1'; :output2 := 'OUTSTR2'; end;";
68:
$cache1 "xxxxxx";
69:
$cache2 "xxxxxx";
70:
71: echo 
"\nTest 3: Bind output parameter within the same scope of execute\n";
72:
$stmt oci_parse($c$sql);
73:
74:
oci_bind_by_name($stmt":output1"$cache1);
75:
oci_bind_by_name($stmt":output2"$cache2);
76:
77:
oci_execute($stmt);
78:
79:
var_dump($cache1);
80:
var_dump($cache2);
81:
82:
oci_free_statement($stmt);
83:
84:
// Test 4: Bind output parameter within the same scope of execute
85:
$sql"begin :output := bindfunc(:var1, :var2); end;";
86:
$cache1 "STR1";
87:
$cache2 "STR2";
88:
89: echo 
"\nTest 4: Bind output parameter within the same scope of execute\n";
90:
$stmt oci_parse($c$sql);
91:
92:
oci_bind_by_name($stmt":var1"$cache1, -1);
93:
oci_bind_by_name($stmt":var2"$cache2, -1);
94:
oci_bind_by_name($stmt":output"$cache3100);
95:
96:
oci_execute($stmt);
97:
98:
var_dump($cache3);
99:
100:
// Test 5: Bind IN OUT parameter in a local function
101:
102:
$sql "call bindproc(:var1, :var2, :var3)";
103:
$cache1 'STR1';
104:
$cache2 'STR2';
105:
$cache3 ' ';
106:
107: echo 
"\nTest 5: Bind IN OUT parameter in a local function\n";
108:
$stmt oci_parse($c$sql);
109:
110:
bindvar($stmt':var1'$cache1);
111:
bindvar($stmt':var2'$cache2);
112:
bindvar($stmt':var3'$cache3);
113:
114:
oci_execute($stmt);
115:
116:
var_dump($cache1);
117:
var_dump($cache2);
118:
var_dump($cache3);
119:
120:
oci_free_statement($stmt);
121:
122:
// Test 6: Bind IN OUT parameter within the same scope of execute 
123:
124:
$sql "call bindproc(:var1, :var2, :var3)";
125:
$cache1 'STR1';
126:
$cache2 'STR2';
127:
$cache3 ' ';
128:
129: echo 
"\nTest 6: Bind IN OUT parameter within the same scope of execute\n";
130:
$stmt oci_parse($c$sql);
131:
132:
oci_bind_by_name($stmt":var1"$cache1, -1);
133:
oci_bind_by_name($stmt":var2"$cache2, -1);
134:
oci_bind_by_name($stmt":var3"$cache3100);
135:
136:
oci_execute($stmt);
137:
138:
var_dump($cache1);
139:
var_dump($cache2);
140:
var_dump($cache3);
141:
142:
// Cleanup
143:
144:
$stmtarray = array(
145:     
"DROP FUNCTION bindfunc",
146:     
"DROP PROCEDURE bindproc"
147:
);
148:
149:
oci8_test_sql_execute($c$stmtarray);
150:
151:
?>
152:
===DONE===
153:

Expected

Test 1: Bind input parameter in a local function
array(2) {
  [":VAR1"]=>
  string(6) "INSTR1"
  [":VAR2"]=>
  string(6) "INSTR2"
}

Test 2: Bind output parameter in a local function
string(6) "xxxxxx"
string(6) "xxxxxx"

Test 3: Bind output parameter within the same scope of execute
string(7) "OUTSTR1"
string(7) "OUTSTR2"

Test 4: Bind output parameter within the same scope of execute
string(8) "STR1STR2"

Test 5: Bind IN OUT parameter in a local function
string(4) "STR1"
string(4) "STR2"
string(1) " "

Test 6: Bind IN OUT parameter within the same scope of execute
string(4) "STR1"
string(4) "STR2"
string(9) "STR1 STR2"
===DONE===

Output

Test 1: Bind input parameter in a local function
array(2) {
  [":VAR1"]=>
  string(6) "INSTR1"
  [":VAR2"]=>
  string(6) "INSTR2"
}

Test 2: Bind output parameter in a local function

Warning: oci_execute(): ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1 in /var/php_gcov/PHP_HEAD/ext/oci8/tests/bug71148.php on line 59
string(6) "xxxxxx"
string(6) "xxxxxx"

Test 3: Bind output parameter within the same scope of execute

Warning: oci_execute(): ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1 in /var/php_gcov/PHP_HEAD/ext/oci8/tests/bug71148.php on line 77
string(6) "xxxxxx"
string(6) "xxxxxx"

Test 4: Bind output parameter within the same scope of execute
string(8) "STR1STR2"

Test 5: Bind IN OUT parameter in a local function
string(4) "STR1"
string(4) "STR2"
string(1) " "

Test 6: Bind IN OUT parameter within the same scope of execute
string(4) "STR1"
string(4) "STR2"
string(9) "STR1 STR2"
===DONE===

Diff

010+ 
011+ Warning: oci_execute(): ORA-06502: PL/SQL: numeric or value error: character string buffer too small
012+ ORA-06512: at line 1 in /var/php_gcov/PHP_HEAD/ext/oci8/tests/bug71148.php on line 59
014- string(7) "OUTSTR1"
015- string(7) "OUTSTR2"
017+ 
018+ Warning: oci_execute(): ORA-06502: PL/SQL: numeric or value error: character string buffer too small
019+ ORA-06512: at line 1 in /var/php_gcov/PHP_HEAD/ext/oci8/tests/bug71148.php on line 77
020+ string(6) "xxxxxx"
021+ string(6) "xxxxxx"

 

Generated at Sun, 12 Nov 2017 21:17:35 +0000 (8 days ago)

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