1--TEST--
2IntlRuleBasedBreakIterator::__construct(): arg errors
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8function print_exception($e) {
9    echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
10}
11
12//missing ; at the end:
13try {
14    var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
15} catch (IntlException $e) {
16    print_exception($e);
17}
18try {
19    var_dump(new IntlRuleBasedBreakIterator());
20} catch (TypeError $e) {
21    print_exception($e);
22}
23try {
24    var_dump(new IntlRuleBasedBreakIterator(1,2,3));
25} catch (TypeError $e) {
26    print_exception($e);
27}
28try {
29    var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
30} catch (TypeError $e) {
31    print_exception($e);
32}
33try {
34    var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
35} catch (IntlException $e) {
36    print_exception($e);
37}
38
39$rbbi = new IntlRuleBasedBreakIterator(".;");
40try {
41    $rbbi->__construct(".;");
42} catch (Error $e) {
43    print_exception($e);
44}
45?>
46--EXPECTF--
47Exception: IntlRuleBasedBreakIterator::__construct(): unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d
48
49Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 argument, 0 given in %s on line %d
50
51Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 arguments, 3 given in %s on line %d
52
53Exception: IntlRuleBasedBreakIterator::__construct(): Argument #2 ($compiled) must be of type bool, array given in %s on line %d
54
55Exception: IntlRuleBasedBreakIterator::__construct(): unable to create instance from compiled rules in %s on line %d
56
57Exception: IntlRuleBasedBreakIterator object is already constructed in %s on line %d
58