Skip to content

Commit e504ed6

Browse files
committed
Add test for oci_set_* error changes
1 parent 4b778fa commit e504ed6

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

ext/oci8/tests/error_set.phpt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
--TEST--
2+
Check oci_set_{action,client_identifier,module_name,client_info} error handling
3+
--SKIPIF--
4+
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
5+
--FILE--
6+
<?php
7+
8+
require(dirname(__FILE__).'/connect.inc');
9+
10+
error_reporting(E_ALL);
11+
ini_set('display_errors', 'Off');
12+
13+
echo "Test 1\n";
14+
15+
// Generates "ORA-24960: the attribute OCI_ATTR_* is greater than the maximum allowable length of 64"
16+
$s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
17+
18+
$r = oci_set_action($c, $s);
19+
var_dump($r);
20+
$m = oci_error($c);
21+
echo $m['code'] , "\n";
22+
23+
$r = oci_set_client_identifier($c, $s);
24+
var_dump($r);
25+
$m = oci_error($c);
26+
echo $m['code'] , "\n";
27+
28+
$r = oci_set_module_name($c, $s);
29+
var_dump($r);
30+
$m = oci_error($c);
31+
echo $m['code'] , "\n";
32+
33+
$r = oci_set_client_info($c, $s);
34+
var_dump($r);
35+
$m = oci_error($c);
36+
echo $m['code'] , "\n";
37+
38+
echo "\nTest 2\n";
39+
$s = "x";
40+
41+
$r = oci_set_action($c, $s);
42+
var_dump($r);
43+
44+
$r = oci_set_client_identifier($c, $s);
45+
var_dump($r);
46+
47+
$r = oci_set_module_name($c, $s);
48+
var_dump($r);
49+
50+
$r = oci_set_client_info($c, $s);
51+
var_dump($r);
52+
53+
?>
54+
===DONE===
55+
<?php exit(0); ?>
56+
--EXPECTF--
57+
Test 1
58+
bool(false)
59+
24960
60+
bool(false)
61+
24960
62+
bool(false)
63+
24960
64+
bool(false)
65+
24960
66+
67+
Test 2
68+
bool(true)
69+
bool(true)
70+
bool(true)
71+
bool(true)
72+
===DONE===

0 commit comments

Comments
 (0)