xref: /PHP-7.3/ext/oci8/tests/pecl_bug16842.phpt (revision a2c0f872)
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(dirname(__FILE__).'/skipif.inc');
7?>
8--INI--
9error_reporting = E_WARNING
10--FILE--
11<?php
12
13require(dirname(__FILE__).'/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===DONE===
37<?php exit(0); ?>
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===DONE===
74