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/bug51291_1.phpt ('Bug #51291 (oci_error() doesn't report last error when called two times)')

Script

1: <?php
2:
3:
require(dirname(__FILE__).'/connect.inc');
4:
5: echo 
"Test 1 - Parse\n";
6:
7:
$s = @oci_parse($c"select ' from dual");
8: if (!
$s) {
9:     
var_dump(oci_error($c));
10:     echo 
"2nd call\n";
11:     
var_dump(oci_error($c));
12: }
13:
14: echo 
"\nTest 2 - Parse\n";
15:
16:
$s = @oci_parse($c"select ' from dual");
17: if (!
$s) {
18:     
var_dump(oci_error(), oci_error($c), oci_error($s));
19:     echo 
"2nd call\n";
20:     
var_dump(oci_error(), oci_error($c), oci_error($s));
21: }
22:
23: echo 
"\nTest 3 - Execute\n";
24:
25:
$s = @oci_parse($c'select doesnotexist from dual');
26:
$r = @oci_execute($sOCI_DEFAULT);
27: if (!
$r) { 
28:     
var_dump(oci_error($s));
29:     echo 
"2nd call\n";
30:     
var_dump(oci_error($s));
31: }
32:
33: echo 
"\nTest 4 - Execute - consecutive oci_error calls of different kinds\n";
34:
35:
$s = @oci_parse($c'select doesnotexist from dual');
36:
$r = @oci_execute($sOCI_DEFAULT);
37: if (!
$r) { 
38:     
var_dump(oci_error(), oci_error($c), oci_error($s));
39:     echo 
"2nd call\n";
40:     
var_dump(oci_error(), oci_error($c), oci_error($s));
41: }
42:
43:
44: echo 
"\nTest 5 - Execute - after oci_rollback\n";
45:
46:
$s = @oci_parse($c'select doesnotexist from dual');
47:
$r = @oci_execute($sOCI_DEFAULT);
48: if (!
$r) { 
49:     
var_dump(oci_error(), oci_error($c), oci_error($s));
50:     
$r oci_rollback($c);
51:     echo 
"Rollback status is ";
52:     if (
is_null($r)) echo "null";
53:     else if (
$r === false) echo "false";
54:     else if (
$r === true) echo "true";
55:     else echo 
$r;
56:     echo 
"\n";
57:     echo 
"2nd call after oci_rollback\n";
58:     
var_dump(oci_error(), oci_error($c), oci_error($s));
59: }
60:
61:
62: echo 
"\nTest 6 - Execute - after successful 2nd query with new handle\n";
63:
64:
$s = @oci_parse($c'select doesnotexist from dual');
65:
$r = @oci_execute($sOCI_DEFAULT);
66: if (!
$r) { 
67:     
var_dump(oci_error(), oci_error($c), oci_error($s));
68:     
$s2 oci_parse($c'select 1 from dual');
69:     
$r oci_execute($s2OCI_DEFAULT);
70:     echo 
"Execute status is ";
71:     if (
is_null($r)) echo "null";
72:     else if (
$r === false) echo "false";
73:     else if (
$r === true) echo "true";
74:     else echo 
$r;
75:     echo 
"\n";
76:     echo 
"2nd call after successful execute\n";
77:     
var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
78: }
79:
80:
81: echo 
"\nTest 7 - Execute - after successful 2nd query with same handle\n";
82:
83:
$s = @oci_parse($c'select doesnotexist from dual');
84:
$r = @oci_execute($sOCI_DEFAULT);
85: if (!
$r) { 
86:     
var_dump(oci_error(), oci_error($c), oci_error($s));
87:     
$s oci_parse($c'select 1 from dual');
88:     
$r oci_execute($sOCI_DEFAULT);
89:     echo 
"Execute status is ";
90:     if (
is_null($r)) echo "null";
91:     else if (
$r === false) echo "false";
92:     else if (
$r === true) echo "true";
93:     else echo 
$r;
94:     echo 
"\n";
95:     echo 
"2nd call after successful execute\n";
96:     
var_dump(oci_error(), oci_error($c), oci_error($s));
97: }
98:
99:
100: echo 
"\nTest 8 - Execute - after unsuccessful 2nd query with new handle\n";
101:
102:
$s = @oci_parse($c'select doesnotexist from dual');
103:
$r = @oci_execute($sOCI_DEFAULT);
104: if (!
$r) { 
105:     
var_dump(oci_error(), oci_error($c), oci_error($s));
106:     
$s2 oci_parse($c'select reallynothere from dual');
107:     
$r oci_execute($s2OCI_DEFAULT);
108:     echo 
"Execute status is ";
109:     if (
is_null($r)) echo "null";
110:     else if (
$r === false) echo "false";
111:     else if (
$r === true) echo "true";
112:     else echo 
$r;
113:     echo 
"\n";
114:     echo 
"2nd call after unsuccessful execute\n";
115:     
var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
116: }
117:
118: echo 
"\nTest 9 - Execute - after unsuccessful 2nd query with same handle\n";
119:
120:
$s = @oci_parse($c'select doesnotexist from dual');
121:
$r = @oci_execute($sOCI_DEFAULT);
122: if (!
$r) { 
123:     
var_dump(oci_error(), oci_error($c), oci_error($s));
124:     
$s oci_parse($c'select reallynothere from dual');
125:     
$r oci_execute($sOCI_DEFAULT);
126:     echo 
"Execute status is ";
127:     if (
is_null($r)) echo "null";
128:     else if (
$r === false) echo "false";
129:     else if (
$r === true) echo "true";
130:     else echo 
$r;
131:     echo 
"\n";
132:     echo 
"2nd call after unsuccessful execute\n";
133:     
var_dump(oci_error(), oci_error($c), oci_error($s));
134: }
135:
136:
?>
137:
===DONE===
138:

Expected

Test 1 - Parse
array(4) {
  ["code"]=>
  int(1756)
  ["message"]=>
  string(48) "ORA-01756: %s"
  ["offset"]=>
  int(0)
  ["sqltext"]=>
  string(0) ""
}
2nd call
array(4) {
  ["code"]=>
  int(1756)
  ["message"]=>
  string(48) "ORA-01756: %s"
  ["offset"]=>
  int(0)
  ["sqltext"]=>
  string(0) ""
}

Test 2 - Parse

Warning: oci_error() expects parameter 1 to be resource, bool given in %sbug51291_1.php on line %d
bool(false)
array(4) {
  ["code"]=>
  int(1756)
  ["message"]=>
  string(48) "ORA-01756: %s"
  ["offset"]=>
  int(0)
  ["sqltext"]=>
  string(0) ""
}
NULL
2nd call

Warning: oci_error() expects parameter 1 to be resource, bool given in %sbug51291_1.php on line %d
bool(false)
array(4) {
  ["code"]=>
  int(1756)
  ["message"]=>
  string(48) "ORA-01756: %s"
  ["offset"]=>
  int(0)
  ["sqltext"]=>
  string(0) ""
}
NULL

Test 3 - Execute
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
2nd call
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}

Test 4 - Execute - consecutive oci_error calls of different kinds
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
2nd call
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}

Test 5 - Execute - after oci_rollback
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
Rollback status is true
2nd call after oci_rollback
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}

Test 6 - Execute - after successful 2nd query with new handle
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
Execute status is true
2nd call after successful execute
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
bool(false)

Test 7 - Execute - after successful 2nd query with same handle
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
Execute status is true
2nd call after successful execute
bool(false)
bool(false)
bool(false)

Test 8 - Execute - after unsuccessful 2nd query with new handle
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}

Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
Execute status is false
2nd call after unsuccessful execute
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904%sREALLYNOTHERE%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(30) "select reallynothere from dual"
}

Test 9 - Execute - after unsuccessful 2nd query with same handle
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904:%sDOESNOTEXIST%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(29) "select doesnotexist from dual"
}

Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
Execute status is false
2nd call after unsuccessful execute
bool(false)
bool(false)
array(4) {
  ["code"]=>
  int(904)
  ["message"]=>
  string(%d) "ORA-00904%sREALLYNOTHERE%s"
  ["offset"]=>
  int(%d)
  ["sqltext"]=>
  string(30) "select reallynothere from dual"
}
===DONE===

Output

***********************************************************************
Fatal NI connect error 12541, connecting to:
 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))

  VERSION INFORMATION:
	TNS for Linux: Version 11.2.0.2.0 - Beta
	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
  Time: 17-JUN-2018 05:06:50
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12541
    TNS-12541: TNS:no listener
    ns secondary err code: 12560
    nt main err code: 511
    TNS-00511: No listener

Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
    nt secondary err code: 111
    nt OS err code: 0

Diff

001+ ***********************************************************************
002+ Fatal NI connect error 12541, connecting to:
003+  (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=XE)(CID=(PROGRAM=php)(HOST=nex2.php.net)(USER=nlopess)))(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
004+ 
005+   VERSION INFORMATION:
006+ 	TNS for Linux: Version 11.2.0.2.0 - Beta
007+ 	TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.2.0 - Beta
008+   Time: 17-JUN-2018 05:06:50
009+   Tracing not turned on.
010+   Tns error struct:
011+     ns main err code: 12541
012+     TNS-12541: TNS:no listener
013+     ns secondary err code: 12560
014+     nt main err code: 511
015+     TNS-00511: No listener
016+ 
017+ Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE': ORA-12541: TNS:no listener in /var/php_gcov/PHP_HEAD/ext/oci8/tests/connect.inc on line 14
018+     nt secondary err code: 111
019+     nt OS err code: 0
001- Test 1 - Parse
002- array(4) {
003-   ["code"]=>
004-   int(1756)
005-   ["message"]=>
006-   string(48) "ORA-01756: %s"
007-   ["offset"]=>
008-   int(0)
009-   ["sqltext"]=>
010-   string(0) ""
011- }
012- 2nd call
013- array(4) {
014-   ["code"]=>
015-   int(1756)
016-   ["message"]=>
017-   string(48) "ORA-01756: %s"
018-   ["offset"]=>
019-   int(0)
020-   ["sqltext"]=>
021-   string(0) ""
022- }
023- 
024- Test 2 - Parse
025- 
026- Warning: oci_error() expects parameter 1 to be resource, bool given in %sbug51291_1.php on line %d
027- bool(false)
028- array(4) {
029-   ["code"]=>
030-   int(1756)
031-   ["message"]=>
032-   string(48) "ORA-01756: %s"
033-   ["offset"]=>
034-   int(0)
035-   ["sqltext"]=>
036-   string(0) ""
037- }
038- NULL
039- 2nd call
040- 
041- Warning: oci_error() expects parameter 1 to be resource, bool given in %sbug51291_1.php on line %d
042- bool(false)
043- array(4) {
044-   ["code"]=>
045-   int(1756)
046-   ["message"]=>
047-   string(48) "ORA-01756: %s"
048-   ["offset"]=>
049-   int(0)
050-   ["sqltext"]=>
051-   string(0) ""
052- }
053- NULL
054- 
055- Test 3 - Execute
056- array(4) {
057-   ["code"]=>
058-   int(904)
059-   ["message"]=>
060-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
061-   ["offset"]=>
062-   int(%d)
063-   ["sqltext"]=>
064-   string(29) "select doesnotexist from dual"
065- }
066- 2nd call
067- array(4) {
068-   ["code"]=>
069-   int(904)
070-   ["message"]=>
071-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
072-   ["offset"]=>
073-   int(%d)
074-   ["sqltext"]=>
075-   string(29) "select doesnotexist from dual"
076- }
077- 
078- Test 4 - Execute - consecutive oci_error calls of different kinds
079- bool(false)
080- bool(false)
081- array(4) {
082-   ["code"]=>
083-   int(904)
084-   ["message"]=>
085-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
086-   ["offset"]=>
087-   int(%d)
088-   ["sqltext"]=>
089-   string(29) "select doesnotexist from dual"
090- }
091- 2nd call
092- bool(false)
093- bool(false)
094- array(4) {
095-   ["code"]=>
096-   int(904)
097-   ["message"]=>
098-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
099-   ["offset"]=>
100-   int(%d)
101-   ["sqltext"]=>
102-   string(29) "select doesnotexist from dual"
103- }
104- 
105- Test 5 - Execute - after oci_rollback
106- bool(false)
107- bool(false)
108- array(4) {
109-   ["code"]=>
110-   int(904)
111-   ["message"]=>
112-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
113-   ["offset"]=>
114-   int(%d)
115-   ["sqltext"]=>
116-   string(29) "select doesnotexist from dual"
117- }
118- Rollback status is true
119- 2nd call after oci_rollback
120- bool(false)
121- bool(false)
122- array(4) {
123-   ["code"]=>
124-   int(904)
125-   ["message"]=>
126-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
127-   ["offset"]=>
128-   int(%d)
129-   ["sqltext"]=>
130-   string(29) "select doesnotexist from dual"
131- }
132- 
133- Test 6 - Execute - after successful 2nd query with new handle
134- bool(false)
135- bool(false)
136- array(4) {
137-   ["code"]=>
138-   int(904)
139-   ["message"]=>
140-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
141-   ["offset"]=>
142-   int(%d)
143-   ["sqltext"]=>
144-   string(29) "select doesnotexist from dual"
145- }
146- Execute status is true
147- 2nd call after successful execute
148- bool(false)
149- bool(false)
150- array(4) {
151-   ["code"]=>
152-   int(904)
153-   ["message"]=>
154-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
155-   ["offset"]=>
156-   int(%d)
157-   ["sqltext"]=>
158-   string(29) "select doesnotexist from dual"
159- }
160- bool(false)
161- 
162- Test 7 - Execute - after successful 2nd query with same handle
163- bool(false)
164- bool(false)
165- array(4) {
166-   ["code"]=>
167-   int(904)
168-   ["message"]=>
169-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
170-   ["offset"]=>
171-   int(%d)
172-   ["sqltext"]=>
173-   string(29) "select doesnotexist from dual"
174- }
175- Execute status is true
176- 2nd call after successful execute
177- bool(false)
178- bool(false)
179- bool(false)
180- 
181- Test 8 - Execute - after unsuccessful 2nd query with new handle
182- bool(false)
183- bool(false)
184- array(4) {
185-   ["code"]=>
186-   int(904)
187-   ["message"]=>
188-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
189-   ["offset"]=>
190-   int(%d)
191-   ["sqltext"]=>
192-   string(29) "select doesnotexist from dual"
193- }
194- 
195- Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
196- Execute status is false
197- 2nd call after unsuccessful execute
198- bool(false)
199- bool(false)
200- array(4) {
201-   ["code"]=>
202-   int(904)
203-   ["message"]=>
204-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
205-   ["offset"]=>
206-   int(%d)
207-   ["sqltext"]=>
208-   string(29) "select doesnotexist from dual"
209- }
210- array(4) {
211-   ["code"]=>
212-   int(904)
213-   ["message"]=>
214-   string(%d) "ORA-00904%sREALLYNOTHERE%s"
215-   ["offset"]=>
216-   int(%d)
217-   ["sqltext"]=>
218-   string(30) "select reallynothere from dual"
219- }
220- 
221- Test 9 - Execute - after unsuccessful 2nd query with same handle
222- bool(false)
223- bool(false)
224- array(4) {
225-   ["code"]=>
226-   int(904)
227-   ["message"]=>
228-   string(%d) "ORA-00904:%sDOESNOTEXIST%s"
229-   ["offset"]=>
230-   int(%d)
231-   ["sqltext"]=>
232-   string(29) "select doesnotexist from dual"
233- }
234- 
235- Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
236- Execute status is false
237- 2nd call after unsuccessful execute
238- bool(false)
239- bool(false)
240- array(4) {
241-   ["code"]=>
242-   int(904)
243-   ["message"]=>
244-   string(%d) "ORA-00904%sREALLYNOTHERE%s"
245-   ["offset"]=>
246-   int(%d)
247-   ["sqltext"]=>
248-   string(30) "select reallynothere from dual"
249- }
250- ===DONE===

 

Generated at Mon, 18 Jun 2018 17:33:50 +0000 (20 hours ago)

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