xref: /PHP-8.2/ext/oci8/tests/pecl_bug16842.phpt (revision b5a14e6c)
1--TEST--
2PECL Bug #16842 (NO_DATA_FOUND exception is a warning)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
8require(__DIR__.'/skipif.inc');
9?>
10--INI--
11error_reporting = E_WARNING
12--FILE--
13<?php
14
15require(__DIR__.'/connect.inc');
16
17// Run Test
18
19echo "Test 1\n";
20
21echo "Raises NO_DATA_FOUND\n";
22$s = oci_parse($c, 'begin raise NO_DATA_FOUND; end;');
23$e = oci_execute($s);
24var_dump($e);
25var_dump(oci_error($s));
26
27echo "Test 2\n";
28
29echo "Raises ZERO_DIVIDE\n";
30$s = oci_parse($c, 'begin raise ZERO_DIVIDE; end;');
31$e = oci_execute($s);
32var_dump($e);
33var_dump(oci_error($s));
34
35oci_close($c);
36
37?>
38--EXPECTF--
39Test 1
40Raises NO_DATA_FOUND
41
42Warning: oci_execute(): ORA-01403: %s
43ORA-06512: at line %d in %specl_bug16842.php on line %d
44bool(false)
45array(4) {
46  ["code"]=>
47  int(1403)
48  ["message"]=>
49  string(%d) "ORA-01403: %s
50ORA-06512: at line 1"
51  ["offset"]=>
52  int(0)
53  ["sqltext"]=>
54  string(31) "begin raise NO_DATA_FOUND; end;"
55}
56Test 2
57Raises ZERO_DIVIDE
58
59Warning: oci_execute(): ORA-01476: %s
60ORA-06512: at line 1 in %s on line 19
61bool(false)
62array(4) {
63  ["code"]=>
64  int(1476)
65  ["message"]=>
66  string(%d) "ORA-01476: %s
67ORA-06512: at line 1"
68  ["offset"]=>
69  int(0)
70  ["sqltext"]=>
71  string(29) "begin raise ZERO_DIVIDE; end;"
72}
73