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