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