1--TEST-- 2IntlRuleBasedBreakIterator::__construct(): arg errors 3--SKIPIF-- 4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> 5<?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip ICU >= 4.8 only'; ?> 6--FILE-- 7<?php 8ini_set("intl.error_level", E_WARNING); 9 10function print_exception($e) { 11 echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; 12} 13 14//missing ; at the end: 15try { 16 var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+')); 17} catch (IntlException $e) { 18 print_exception($e); 19} 20try { 21 var_dump(new IntlRuleBasedBreakIterator()); 22} catch (TypeError $e) { 23 print_exception($e); 24} 25try { 26 var_dump(new IntlRuleBasedBreakIterator(1,2,3)); 27} catch (TypeError $e) { 28 print_exception($e); 29} 30try { 31 var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); 32} catch (TypeError $e) { 33 print_exception($e); 34} 35try { 36 var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true)); 37} catch (IntlException $e) { 38 print_exception($e); 39} 40--EXPECTF-- 41Exception: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d 42 43Exception: IntlRuleBasedBreakIterator::__construct() expects at least 1 parameter, 0 given in %s on line %d 44 45Exception: IntlRuleBasedBreakIterator::__construct() expects at most 2 parameters, 3 given in %s on line %d 46 47Exception: IntlRuleBasedBreakIterator::__construct() expects parameter 2 to be boolean, array given in %s on line %d 48 49Exception: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create instance from compiled rules in %s on line %d 50