diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-03 22:52:20 +0100 |
commit | f8d795820e780a6322e054c26c581570613c14f0 (patch) | |
tree | 99d3ae01ce564752807341c5743863b4c92513f8 /ext/intl | |
parent | d2cb200e10ada6fa44c54a29292bb4665728fff0 (diff) | |
download | php-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz |
Reindent phpt files
Diffstat (limited to 'ext/intl')
155 files changed, 3496 insertions, 3496 deletions
diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt index c3d7a331c2..3cc04dbf64 100644 --- a/ext/intl/tests/badargs.phpt +++ b/ext/intl/tests/badargs.phpt @@ -14,13 +14,13 @@ foreach($funcs as $func) { continue; } - try { - $res = $func($arg); - } catch (Exception $e) { - continue; - } catch (Error $e) { - continue; - } + try { + $res = $func($arg); + } catch (Exception $e) { + continue; + } catch (Error $e) { + continue; + } if($res != false) { echo "$func: "; var_dump($res); diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index 595c6b283a..8b36b4a7cf 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -7,34 +7,34 @@ IntlRuleBasedBreakIterator::__construct(): arg errors ini_set("intl.error_level", E_WARNING); function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } //missing ; at the end: try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+')); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+')); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator()); + var_dump(new IntlRuleBasedBreakIterator()); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator(1,2,3)); + var_dump(new IntlRuleBasedBreakIterator(1,2,3)); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); } catch (TypeError $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true)); + var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } --EXPECTF-- Exception: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt index 4d05792c0e..ac7b17505d 100644 --- a/ext/intl/tests/breakiter_factories_basic.phpt +++ b/ext/intl/tests/breakiter_factories_basic.phpt @@ -10,17 +10,17 @@ ini_set("intl.error_level", E_WARNING); ini_set("intl.default_locale", "ja"); $m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance', - 'createSentenceInstance', 'createTitleInstance'); + 'createSentenceInstance', 'createTitleInstance'); $t = 'Frase 1... Frase 2'; foreach ($m as $method) { - echo "===== $method =====\n"; - $o1 = IntlBreakIterator::$method('ja'); - $o2 = IntlBreakIterator::$method(NULL); - $o3 = IntlBreakIterator::$method(); - var_dump($o1 == $o2 && $o2 == $o3); - echo "\n"; + echo "===== $method =====\n"; + $o1 = IntlBreakIterator::$method('ja'); + $o2 = IntlBreakIterator::$method(NULL); + $o3 = IntlBreakIterator::$method(); + var_dump($o1 == $o2 && $o2 == $o3); + echo "\n"; } --EXPECT-- ===== createWordInstance ===== diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt index e2fc194944..36d8e2f320 100644 --- a/ext/intl/tests/bug12887.phpt +++ b/ext/intl/tests/bug12887.phpt @@ -7,13 +7,13 @@ locale_get_keywords() bug #12887 function ut_main() { - $res_str = ''; - $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' ); - if ($keywords_arr) { - foreach( $keywords_arr as $key => $value){ - $res_str .= "$key = $value\n"; - } - } + $res_str = ''; + $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' ); + if ($keywords_arr) { + foreach( $keywords_arr as $key => $value){ + $res_str .= "$key = $value\n"; + } + } $res_str .= "\n"; return $res_str; diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt index 7cf927f7e7..ec9a046b75 100644 --- a/ext/intl/tests/bug14562.phpt +++ b/ext/intl/tests/bug14562.phpt @@ -7,17 +7,17 @@ Bug #14562 NumberFormatter breaks when locale changes function ut_main() { - $res_str = ""; - $de_locale="de_DE.UTF-8"; - $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); - $numeric = $fmt->parse("1234,56"); - $res_str .= "$numeric\n"; - setlocale(LC_ALL, $de_locale); - $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); - $numeric = $fmt->parse("1234,56"); - setlocale(LC_ALL, "C"); // reset for printing - $res_str .= "$numeric\n"; - return $res_str; + $res_str = ""; + $de_locale="de_DE.UTF-8"; + $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); + $numeric = $fmt->parse("1234,56"); + $res_str .= "$numeric\n"; + setlocale(LC_ALL, $de_locale); + $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL ); + $numeric = $fmt->parse("1234,56"); + setlocale(LC_ALL, "C"); // reset for printing + $res_str .= "$numeric\n"; + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/bug53512.phpt b/ext/intl/tests/bug53512.phpt index 872e5987be..af2dda8f69 100644 --- a/ext/intl/tests/bug53512.phpt +++ b/ext/intl/tests/bug53512.phpt @@ -10,9 +10,9 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only'); $badvals = array(4294901761, 2147483648, -2147483648, -1); foreach ($badvals as $val) { - $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL); - var_dump(numfmt_set_symbol($x, $val, "")); - var_dump(intl_get_error_message()); + $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL); + var_dump(numfmt_set_symbol($x, $val, "")); + var_dump(intl_get_error_message()); } ?> diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt index 13b51ec6ce..01673b8c48 100644 --- a/ext/intl/tests/bug58756_MessageFormatter.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter.phpt @@ -26,7 +26,7 @@ echo "msgf: " . $msgf->format(array($time)) . "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt index a6a58906cc..790033c95b 100644 --- a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt +++ b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt @@ -26,7 +26,7 @@ echo "msgf: " . $msgf->format(array($time)) . "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt index 096b57558f..bd5faa11ed 100644 --- a/ext/intl/tests/bug60192-compare.phpt +++ b/ext/intl/tests/bug60192-compare.phpt @@ -7,9 +7,9 @@ Bug #60192 (SegFault when Collator not constructed properly) --FILE-- <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt index ef5ce3fc04..526632192e 100644 --- a/ext/intl/tests/bug60192-getlocale.phpt +++ b/ext/intl/tests/bug60192-getlocale.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt index 21cc279eee..96df981cf5 100644 --- a/ext/intl/tests/bug60192-getsortkey.phpt +++ b/ext/intl/tests/bug60192-getsortkey.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt index 530d5eecba..27899fdd4f 100644 --- a/ext/intl/tests/bug60192-sort.phpt +++ b/ext/intl/tests/bug60192-sort.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt index 9ee58123c8..7f22c003c3 100644 --- a/ext/intl/tests/bug60192-sortwithsortkeys.phpt +++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt @@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly) <?php class Collator2 extends Collator{ - public function __construct() { - // omitting parent::__construct($someLocale); - } + public function __construct() { + // omitting parent::__construct($someLocale); + } } $c = new Collator2(); diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt index 2f3c816f99..f2fa15a81d 100644 --- a/ext/intl/tests/bug62017.phpt +++ b/ext/intl/tests/bug62017.phpt @@ -8,14 +8,14 @@ if (!extension_loaded('intl')) <?php ini_set('intl.error_level', E_WARNING); var_dump( - datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF", - IntlDateFormatter::GREGORIAN, 'a')); + datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF", + IntlDateFormatter::GREGORIAN, 'a')); try { - var_dump( - new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", - IntlDateFormatter::GREGORIAN, "\x80")); + var_dump( + new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon", + IntlDateFormatter::GREGORIAN, "\x80")); } catch (IntlException $e) { - echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL; + echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL; } --EXPECTF-- Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt index 8dc3bd1512..a10b476ab4 100644 --- a/ext/intl/tests/bug62915-2.phpt +++ b/ext/intl/tests/bug62915-2.phpt @@ -9,24 +9,24 @@ if (!class_exists('Spoofchecker')) --FILE-- <?php class A extends IntlDateFormatter { - static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, - 'America/Los_Angeles', IntlDateFormatter::GREGORIAN); + static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL, + 'America/Los_Angeles', IntlDateFormatter::GREGORIAN); } class B extends NumberFormatter { - static $ARGS = array('de_DE', NumberFormatter::DECIMAL); + static $ARGS = array('de_DE', NumberFormatter::DECIMAL); } class C extends MessageFormatter { - static $ARGS = array("en_US", "foo"); + static $ARGS = array("en_US", "foo"); } class D extends Spoofchecker { - static $ARGS = array(); + static $ARGS = array(); } foreach (range('A', 'D') as $subclass) { - $rc = new ReflectionClass($subclass); - $obj = $rc->newInstanceArgs($subclass::$ARGS); - $clone = clone $obj; - var_dump(get_class($clone)); + $rc = new ReflectionClass($subclass); + $obj = $rc->newInstanceArgs($subclass::$ARGS); + $clone = clone $obj; + var_dump(get_class($clone)); } --EXPECT-- string(1) "A" diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt index 2277cde9d5..45d2dea5e9 100644 --- a/ext/intl/tests/bug62915.phpt +++ b/ext/intl/tests/bug62915.phpt @@ -8,17 +8,17 @@ if (!extension_loaded('intl')) <?php class foo extends IntlTimeZone { - public $foo = 'test'; + public $foo = 'test'; - public function __construct() { } + public function __construct() { } } $x = new foo; try { - $z = clone $x; + $z = clone $x; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECT-- string(39) "Cannot clone unconstructed IntlTimeZone" diff --git a/ext/intl/tests/bug71020.phpt b/ext/intl/tests/bug71020.phpt index 9f9b8eede3..582275967f 100644 --- a/ext/intl/tests/bug71020.phpt +++ b/ext/intl/tests/bug71020.phpt @@ -7,7 +7,7 @@ Bug #71020 (Use after free in Collator::sortWithSortKeys) $var_3=new Collator("Whatever"); for($x=0;$x<0xbb;$x++) - $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x); + $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x); $var_3->sortWithSortKeys($myarray); ?> okey diff --git a/ext/intl/tests/bug72533.phpt b/ext/intl/tests/bug72533.phpt index 1faf08c287..bf48c83c70 100644 --- a/ext/intl/tests/bug72533.phpt +++ b/ext/intl/tests/bug72533.phpt @@ -9,15 +9,15 @@ function ut_main() { $ret = var_export(ut_loc_accept_http(str_repeat('x', 256)), true); $ret .= "\n"; - if(intl_is_failure(intl_get_error_code())) { - $ret .= var_export(intl_get_error_message(), true); - } + if(intl_is_failure(intl_get_error_code())) { + $ret .= var_export(intl_get_error_message(), true); + } $ret .= "\n"; $ret .= var_export(ut_loc_accept_http(str_repeat('en,', 256)), true); $ret .= "\n"; - if(intl_is_failure(intl_get_error_code())) { - $ret .= var_export(intl_get_error_message(), true); - } + if(intl_is_failure(intl_get_error_code())) { + $ret .= var_export(intl_get_error_message(), true); + } return $ret; } diff --git a/ext/intl/tests/bug72639.phpt b/ext/intl/tests/bug72639.phpt index 2c94dcc06f..ca9b219715 100644 --- a/ext/intl/tests/bug72639.phpt +++ b/ext/intl/tests/bug72639.phpt @@ -6,7 +6,7 @@ Bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds <?php class A extends IntlCalendar { public function __construct() {} - private $a; + private $a; } var_dump(new A()); ?> diff --git a/ext/intl/tests/calendar_add_basic.phpt b/ext/intl/tests/calendar_add_basic.phpt index 4d333594a1..3e8ed55579 100644 --- a/ext/intl/tests/calendar_add_basic.phpt +++ b/ext/intl/tests/calendar_add_basic.phpt @@ -22,8 +22,8 @@ $intlcal->add(IntlCalendar::FIELD_MINUTE, 6); intlcal_add($intlcal, IntlCalendar::FIELD_SECOND, 7); var_dump( - (float)$time2*1000, - $intlcal->getTime()); + (float)$time2*1000, + $intlcal->getTime()); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt index 4d34ae77f5..66fb62f224 100644 --- a/ext/intl/tests/calendar_before_after_error.phpt +++ b/ext/intl/tests/calendar_before_after_error.phpt @@ -18,47 +18,47 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->after()); + var_dump($c->after()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before()); + var_dump($c->before()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->after(1)); + var_dump($c->after(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before(1)); + var_dump($c->before(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump($c->after($c, 1)); + var_dump($c->after($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->before($c, 1)); + var_dump($c->before($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_after($c)); + var_dump(intlcal_after($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_before($c)); + var_dump(intlcal_before($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given diff --git a/ext/intl/tests/calendar_clear_basic.phpt b/ext/intl/tests/calendar_clear_basic.phpt index 221eec9ff0..1c4b40f424 100644 --- a/ext/intl/tests/calendar_clear_basic.phpt +++ b/ext/intl/tests/calendar_clear_basic.phpt @@ -12,13 +12,13 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump($intlcal->clear()); var_dump( - $intlcal->get(IntlCalendar::FIELD_YEAR), - $intlcal->get(IntlCalendar::FIELD_MONTH), - $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->get(IntlCalendar::FIELD_HOUR), - $intlcal->get(IntlCalendar::FIELD_MINUTE), - $intlcal->get(IntlCalendar::FIELD_SECOND), - $intlcal->get(IntlCalendar::FIELD_MILLISECOND) + $intlcal->get(IntlCalendar::FIELD_YEAR), + $intlcal->get(IntlCalendar::FIELD_MONTH), + $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->get(IntlCalendar::FIELD_HOUR), + $intlcal->get(IntlCalendar::FIELD_MINUTE), + $intlcal->get(IntlCalendar::FIELD_SECOND), + $intlcal->get(IntlCalendar::FIELD_MILLISECOND) ); $intlcal2 = IntlCalendar::createInstance('Europe/Amsterdam'); diff --git a/ext/intl/tests/calendar_clear_variation1.phpt b/ext/intl/tests/calendar_clear_variation1.phpt index 7b5033167f..6bc97b6c71 100644 --- a/ext/intl/tests/calendar_clear_variation1.phpt +++ b/ext/intl/tests/calendar_clear_variation1.phpt @@ -19,8 +19,8 @@ var_dump($intlcal->clear(IntlCalendar::FIELD_MONTH)); var_dump($intlcal->isSet(IntlCalendar::FIELD_MONTH)); //print_R($intlcal); var_dump( - $intlcal->getTime(), - strtotime('2012-01-29 05:06:07 +0000') * 1000. + $intlcal->getTime(), + strtotime('2012-01-29 05:06:07 +0000') * 1000. ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt index 4e6f40b43d..04896458b2 100644 --- a/ext/intl/tests/calendar_equals_error.phpt +++ b/ext/intl/tests/calendar_equals_error.phpt @@ -18,31 +18,31 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->equals()); + var_dump($c->equals()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->equals(new stdclass)); + var_dump($c->equals(new stdclass)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->equals(1, 2)); + var_dump($c->equals(1, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_equals($c, array())); + var_dump(intlcal_equals($c, array())); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_equals(1, $c)); + var_dump(intlcal_equals(1, $c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given diff --git a/ext/intl/tests/calendar_fieldDifference_basic.phpt b/ext/intl/tests/calendar_fieldDifference_basic.phpt index a7202e9bee..918f279fb1 100644 --- a/ext/intl/tests/calendar_fieldDifference_basic.phpt +++ b/ext/intl/tests/calendar_fieldDifference_basic.phpt @@ -14,18 +14,18 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->fieldDifference( - strtotime('2012-02-29 06:06:08 +0000') * 1000, - IntlCalendar::FIELD_SECOND), - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY)); + $intlcal->fieldDifference( + strtotime('2012-02-29 06:06:08 +0000') * 1000, + IntlCalendar::FIELD_SECOND), + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY)); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - intlcal_field_difference( - $intlcal, - strtotime('2012-02-29 06:07:08 +0000') * 1000, - IntlCalendar::FIELD_MINUTE)); + intlcal_field_difference( + $intlcal, + strtotime('2012-02-29 06:07:08 +0000') * 1000, + IntlCalendar::FIELD_MINUTE)); ?> --EXPECT-- int(3601) diff --git a/ext/intl/tests/calendar_fromDateTime_basic.phpt b/ext/intl/tests/calendar_fromDateTime_basic.phpt index 0c7e471454..dcbd4e1c61 100644 --- a/ext/intl/tests/calendar_fromDateTime_basic.phpt +++ b/ext/intl/tests/calendar_fromDateTime_basic.phpt @@ -12,28 +12,28 @@ date_default_timezone_set('Europe/Lisbon'); $cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00 Europe/Rome'); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., - $cal->getTimeZone()->getID(), - $cal->getLocale(1) + $cal->getTime(), + strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) ); echo "\n"; $cal = IntlCalendar::fromDateTime(new DateTime('2012-01-01 00:00:00 PST'), "pt_PT"); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 PST') * 1000., - $cal->getTimeZone()->getID(), - $cal->getLocale(1) + $cal->getTime(), + strtotime('2012-01-01 00:00:00 PST') * 1000., + $cal->getTimeZone()->getID(), + $cal->getLocale(1) ); echo "\n"; $cal = intlcal_from_date_time(new DateTime('2012-01-01 00:00:00 +03:40')); var_dump( - $cal->getTime(), - strtotime('2012-01-01 00:00:00 +03:40') * 1000., - $cal->getTimeZone()->getID() + $cal->getTime(), + strtotime('2012-01-01 00:00:00 +03:40') * 1000., + $cal->getTimeZone()->getID() ); --EXPECTF-- float(1325372400000) diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt index 7a9c8afa94..c525dca988 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt @@ -16,11 +16,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000); var_dump( - intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) + intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) ); ?> diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt index 1dc4bb90a6..982eaf4251 100644 --- a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt +++ b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt @@ -16,11 +16,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000); var_dump( - intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), - $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) + intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY), + $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY) ); ?> diff --git a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt index 233ca30b26..2bd97330ed 100644 --- a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt +++ b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt @@ -13,19 +13,19 @@ ini_set("intl.default_locale", "nl"); $intlcal = new IntlGregorianCalendar(2012, 1, 29); var_dump( - $intlcal->getErrorCode(), - intlcal_get_error_code($intlcal), - $intlcal->getErrorMessage(), - intlcal_get_error_message($intlcal) + $intlcal->getErrorCode(), + intlcal_get_error_code($intlcal), + $intlcal->getErrorMessage(), + intlcal_get_error_message($intlcal) ); $intlcal->add(IntlCalendar::FIELD_SECOND, 2147483647); $intlcal->fieldDifference(-PHP_INT_MAX, IntlCalendar::FIELD_SECOND); var_dump( - $intlcal->getErrorCode(), - intlcal_get_error_code($intlcal), - $intlcal->getErrorMessage(), - intlcal_get_error_message($intlcal) + $intlcal->getErrorCode(), + intlcal_get_error_code($intlcal), + $intlcal->getErrorMessage(), + intlcal_get_error_message($intlcal) ); ?> --EXPECTF-- diff --git a/ext/intl/tests/calendar_getXMaximum_basic.phpt b/ext/intl/tests/calendar_getXMaximum_basic.phpt index d9591c632a..82e77b8c8e 100644 --- a/ext/intl/tests/calendar_getXMaximum_basic.phpt +++ b/ext/intl/tests/calendar_getXMaximum_basic.phpt @@ -14,12 +14,12 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) + $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) ); ?> diff --git a/ext/intl/tests/calendar_getXMinimum_basic.phpt b/ext/intl/tests/calendar_getXMinimum_basic.phpt index f8f951ed9d..a1f52b361d 100644 --- a/ext/intl/tests/calendar_getXMinimum_basic.phpt +++ b/ext/intl/tests/calendar_getXMinimum_basic.phpt @@ -14,12 +14,12 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000); var_dump( - $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), - $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), - intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) + $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH), + $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH), + intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH) ); ?> diff --git a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt index 828f6a71d0..211636cd63 100644 --- a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt +++ b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt @@ -28,24 +28,24 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump(intlcal_get_least_maximum(1, 1)); + var_dump(intlcal_get_least_maximum(1, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_maximum(1, 1)); + var_dump(intlcal_get_maximum(1, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_greatest_minimum(1, -1)); + var_dump(intlcal_get_greatest_minimum(1, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_minimum(1, -1)); + var_dump(intlcal_get_minimum(1, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECTF-- Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: invalid field in %s on line %d diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt index 22a4b859ab..5921d0c0d3 100644 --- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt +++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt @@ -18,67 +18,67 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump(intlcal_get($c)); + var_dump(intlcal_get($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c)); + var_dump(intlcal_get_actual_maximum($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c)); + var_dump(intlcal_get_actual_minimum($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get($c, -1)); + var_dump(intlcal_get($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c, -1)); + var_dump(intlcal_get_actual_maximum($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c, -1)); + var_dump(intlcal_get_actual_minimum($c, -1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get($c, "s")); + var_dump(intlcal_get($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum($c, "s")); + var_dump(intlcal_get_actual_maximum($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum($c, "s")); + var_dump(intlcal_get_actual_minimum($c, "s")); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get(1)); + var_dump(intlcal_get(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_maximum(1)); + var_dump(intlcal_get_actual_maximum(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_get_actual_minimum(1)); + var_dump(intlcal_get_actual_minimum(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, intlcal_get() expects exactly 2 parameters, 1 given diff --git a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt index e789840e00..83e6b84645 100644 --- a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt +++ b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt @@ -18,8 +18,8 @@ var_dump($intlcal->getRepeatedWallTimeOption()); $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); var_dump( - strtotime('2012-10-28 02:30:00 +0100'), - (int)($intlcal->getTime() /1000) + strtotime('2012-10-28 02:30:00 +0100'), + (int)($intlcal->getTime() /1000) ); var_dump(intlcal_set_repeated_wall_time_option($intlcal, IntlCalendar::WALLTIME_FIRST)); @@ -27,8 +27,8 @@ var_dump(intlcal_get_repeated_wall_time_option($intlcal)); $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); var_dump( - strtotime('2012-10-28 02:30:00 +0200'), - (int)($intlcal->getTime() /1000) + strtotime('2012-10-28 02:30:00 +0200'), + (int)($intlcal->getTime() /1000) ); ?> diff --git a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt index 4cefc4126c..2f96aaf96d 100644 --- a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt +++ b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt @@ -18,8 +18,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 3h30\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); var_dump($intlcal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_FIRST)); @@ -28,8 +28,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 1h30\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); var_dump(intlcal_set_skipped_wall_time_option($intlcal, IntlCalendar::WALLTIME_NEXT_VALID)); @@ -38,8 +38,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2); $intlcal->set(IntlCalendar::FIELD_MINUTE, 30); echo "Should be 3h00\n"; var_dump( - $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), - $intlcal->get(IntlCalendar::FIELD_MINUTE) + $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY), + $intlcal->get(IntlCalendar::FIELD_MINUTE) ); diff --git a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt index f856f6a2ad..5e78c0b92c 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt @@ -16,14 +16,14 @@ $intlcal4 = IntlCalendar::createInstance('Europe/Amsterdam'); $intlcal4->roll(IntlCalendar::FIELD_MONTH, true); var_dump( - "1 - 1", - $intlcal1->isEquivalentTo($intlcal1), - "1 - 2", - $intlcal1->isEquivalentTo($intlcal2), - "1 - 3", - $intlcal1->isEquivalentTo($intlcal3), - "1 - 4", - $intlcal1->isEquivalentTo($intlcal4) + "1 - 1", + $intlcal1->isEquivalentTo($intlcal1), + "1 - 2", + $intlcal1->isEquivalentTo($intlcal2), + "1 - 3", + $intlcal1->isEquivalentTo($intlcal3), + "1 - 4", + $intlcal1->isEquivalentTo($intlcal4) ); ?> diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt index 9faecdd7e1..ce1536f920 100644 --- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt +++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt @@ -18,35 +18,35 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->isEquivalentTo(0)); + var_dump($c->isEquivalentTo(0)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->isEquivalentTo($c, 1)); + var_dump($c->isEquivalentTo($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->isEquivalentTo(1)); + var_dump($c->isEquivalentTo(1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to($c)); + var_dump(intlcal_is_equivalent_to($c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to($c, 1)); + var_dump(intlcal_is_equivalent_to($c, 1)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump(intlcal_is_equivalent_to(1, $c)); + var_dump(intlcal_is_equivalent_to(1, $c)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt index d2e0867c29..5ca4afc918 100644 --- a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt +++ b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt @@ -11,11 +11,11 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump( - IntlCalendar::DOW_TUESDAY, - $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY), - $intlcal->getFirstDayOfWeek(), - intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY), - $intlcal->getFirstDayOfWeek() + IntlCalendar::DOW_TUESDAY, + $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY), + $intlcal->getFirstDayOfWeek(), + intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY), + $intlcal->getFirstDayOfWeek() ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt index 455bd84368..e256608531 100644 --- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt +++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt @@ -11,10 +11,10 @@ ini_set("intl.default_locale", "nl"); $intlcal = IntlCalendar::createInstance('UTC'); var_dump( - $intlcal->setMinimalDaysInFirstWeek(6), - $intlcal->getMinimalDaysInFirstWeek(), - intlcal_set_minimal_days_in_first_week($intlcal, 5), - $intlcal->getMinimalDaysInFirstWeek() + $intlcal->setMinimalDaysInFirstWeek(6), + $intlcal->getMinimalDaysInFirstWeek(), + intlcal_set_minimal_days_in_first_week($intlcal, 5), + $intlcal->getMinimalDaysInFirstWeek() ); ?> --EXPECT-- diff --git a/ext/intl/tests/calendar_setTimeZone_basic.phpt b/ext/intl/tests/calendar_setTimeZone_basic.phpt index bfd4f43a42..7e52589b81 100644 --- a/ext/intl/tests/calendar_setTimeZone_basic.phpt +++ b/ext/intl/tests/calendar_setTimeZone_basic.phpt @@ -20,7 +20,7 @@ echo "\n"; var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET)); intlcal_set_time_zone($intlcal, - IntlTimeZone::createTimeZone('GMT+05:30')); + IntlTimeZone::createTimeZone('GMT+05:30')); print_r($intlcal->getTimeZone()->getID()); echo "\n"; var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET)); diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt index 3f5e479e79..c44208d1ce 100644 --- a/ext/intl/tests/calendar_setTimeZone_error.phpt +++ b/ext/intl/tests/calendar_setTimeZone_error.phpt @@ -20,25 +20,25 @@ echo "error: $errno, $errstr\n"; set_error_handler('eh'); try { - var_dump($c->setTimeZone($gmt, 2)); + var_dump($c->setTimeZone($gmt, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try { - var_dump($c->setTimeZone()); + var_dump($c->setTimeZone()); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump(intlcal_set_time_zone($c, 1, 2)); + var_dump(intlcal_set_time_zone($c, 1, 2)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } try{ - var_dump(intlcal_set_time_zone(1, $gmt)); + var_dump(intlcal_set_time_zone(1, $gmt)); } catch (Error $ex) { - echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; + echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; } --EXPECT-- error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given diff --git a/ext/intl/tests/calendar_setTime_basic.phpt b/ext/intl/tests/calendar_setTime_basic.phpt index 91ccc10fad..075ecaabb5 100644 --- a/ext/intl/tests/calendar_setTime_basic.phpt +++ b/ext/intl/tests/calendar_setTime_basic.phpt @@ -17,8 +17,8 @@ $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->setTime($time * 1000); var_dump( - (float)$time*1000, - $intlcal->getTime()); + (float)$time*1000, + $intlcal->getTime()); $intlcal = IntlCalendar::createInstance('UTC'); intlcal_set_time($intlcal,$time * 1000); diff --git a/ext/intl/tests/calendar_set_variation1.phpt b/ext/intl/tests/calendar_set_variation1.phpt index 8738d30711..6a78cf213c 100644 --- a/ext/intl/tests/calendar_set_variation1.phpt +++ b/ext/intl/tests/calendar_set_variation1.phpt @@ -15,16 +15,16 @@ $intlcal = IntlCalendar::createInstance('UTC'); $intlcal->clear(); var_dump($intlcal->set(2012, 1, 29)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 00:00:00 +0000') * 1000.); + strtotime('2012-02-29 00:00:00 +0000') * 1000.); //two minutes to midnight! var_dump($intlcal->set(2012, 1, 29, 23, 58)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 23:58:00 +0000') * 1000.); + strtotime('2012-02-29 23:58:00 +0000') * 1000.); var_dump($intlcal->set(2012, 1, 29, 23, 58, 31)); var_dump($intlcal->getTime(), - strtotime('2012-02-29 23:58:31 +0000') * 1000.); + strtotime('2012-02-29 23:58:31 +0000') * 1000.); ?> --EXPECT-- diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt index 0b3d0ee795..7f0af95079 100644 --- a/ext/intl/tests/collator_asort.phpt +++ b/ext/intl/tests/collator_asort.phpt @@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR $res_dump = "\n" . dump( $test_array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_asort_variant2.phpt b/ext/intl/tests/collator_asort_variant2.phpt index 08725095b5..a5a16e5aeb 100644 --- a/ext/intl/tests/collator_asort_variant2.phpt +++ b/ext/intl/tests/collator_asort_variant2.phpt @@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR $res_dump = "\n" . dump( $test_array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_create2.phpt b/ext/intl/tests/collator_create2.phpt index 292e3cebb5..27f0381992 100644 --- a/ext/intl/tests/collator_create2.phpt +++ b/ext/intl/tests/collator_create2.phpt @@ -22,7 +22,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_create3.phpt b/ext/intl/tests/collator_create3.phpt index 8d9308aca1..1060c72326 100644 --- a/ext/intl/tests/collator_create3.phpt +++ b/ext/intl/tests/collator_create3.phpt @@ -23,7 +23,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_create4.phpt b/ext/intl/tests/collator_create4.phpt index 509a89913b..dafeaf4e87 100644 --- a/ext/intl/tests/collator_create4.phpt +++ b/ext/intl/tests/collator_create4.phpt @@ -22,7 +22,7 @@ function ut_main() '', 'root', 'uk@currency=EURO', - '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' + '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799' ); foreach( $locales as $locale ) diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt index 62cc3a7b11..b7cd8bb5ec 100644 --- a/ext/intl/tests/collator_get_sort_key.phpt +++ b/ext/intl/tests/collator_get_sort_key.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant2.phpt b/ext/intl/tests/collator_get_sort_key_variant2.phpt index 3c526fbc3c..ab3fc64e32 100644 --- a/ext/intl/tests/collator_get_sort_key_variant2.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant2.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant3.phpt b/ext/intl/tests/collator_get_sort_key_variant3.phpt index f4cb88e3e7..9e84ad4168 100644 --- a/ext/intl/tests/collator_get_sort_key_variant3.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant3.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant4.phpt b/ext/intl/tests/collator_get_sort_key_variant4.phpt index bd7af6a284..078a385d5c 100644 --- a/ext/intl/tests/collator_get_sort_key_variant4.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant4.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant5.phpt b/ext/intl/tests/collator_get_sort_key_variant5.phpt index c7717389b7..38d96cf2d8 100644 --- a/ext/intl/tests/collator_get_sort_key_variant5.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant5.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant6.phpt b/ext/intl/tests/collator_get_sort_key_variant6.phpt index 78c74f546a..54e7486816 100644 --- a/ext/intl/tests/collator_get_sort_key_variant6.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant6.phpt @@ -16,11 +16,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -32,9 +32,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -42,7 +42,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_get_sort_key_variant7.phpt b/ext/intl/tests/collator_get_sort_key_variant7.phpt index e009d0e663..8ac0154d4f 100644 --- a/ext/intl/tests/collator_get_sort_key_variant7.phpt +++ b/ext/intl/tests/collator_get_sort_key_variant7.phpt @@ -15,11 +15,11 @@ function sort_arrays( $locale, $data ) $coll = ut_coll_create( $locale ); - foreach($data as $value) { - $res_val = ut_coll_get_sort_key( $coll, $value ); - $res_str .= "source: ".$value."\n". - "key: ".bin2hex($res_val)."\n"; - } + foreach($data as $value) { + $res_val = ut_coll_get_sort_key( $coll, $value ); + $res_str .= "source: ".$value."\n". + "key: ".bin2hex($res_val)."\n"; + } return $res_str; } @@ -31,9 +31,9 @@ function ut_main() // Regular strings keys $test_params = array( - 'abc', 'abd', 'aaa', - 'аа', 'а', 'z', - '', null , '3', + 'abc', 'abd', 'aaa', + 'аа', 'а', 'z', + '', null , '3', 'y' , 'i' , 'k' ); @@ -41,7 +41,7 @@ function ut_main() // Sort a non-ASCII array using ru_RU locale. $test_params = array( - 'абг', 'абв', 'жжж', 'эюя' + 'абг', 'абв', 'жжж', 'эюя' ); $res_str .= sort_arrays( 'ru_RU', $test_params ); diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt index 4f7a12352a..1c4cb78cc8 100644 --- a/ext/intl/tests/collator_sort.phpt +++ b/ext/intl/tests/collator_sort.phpt @@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR ) $res_dump = "\n" . dump( $array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/collator_sort_variant2.phpt b/ext/intl/tests/collator_sort_variant2.phpt index abb302eda6..3838c881ad 100644 --- a/ext/intl/tests/collator_sort_variant2.phpt +++ b/ext/intl/tests/collator_sort_variant2.phpt @@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR ) $res_dump = "\n" . dump( $array ) . "\n Result: " . dump( $res_val ); - // Preppend test signature to output string + // Preppend test signature to output string $md5 = md5( $res_dump ); global $test_num; diff --git a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt index 08aa01e90b..a1c33cf230 100644 --- a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt +++ b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt @@ -20,25 +20,25 @@ var_dump($codepoint_it->getLastCodePoint()); //before the last read codepoint is moving backwards $p = $codepoint_it->first(); while ($p != IntlBreakIterator::DONE) { - $c = $codepoint_it->getLastCodePoint(); - if ($c > 0) - var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); - else - var_dump($c); - //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint - //starting at the initial position and only then moves the pointer forward - $p = $codepoint_it->next(); + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint + //starting at the initial position and only then moves the pointer forward + $p = $codepoint_it->next(); } echo "Now backwards\n"; $p = $codepoint_it->last(); while ($p != IntlBreakIterator::DONE) { - $c = $codepoint_it->getLastCodePoint(); - if ($c > 0) - var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); - else - var_dump($c); - $p = $codepoint_it->previous(); + $c = $codepoint_it->getLastCodePoint(); + if ($c > 0) + var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint())); + else + var_dump($c); + $p = $codepoint_it->previous(); } diff --git a/ext/intl/tests/cpbi_parts_iterator.phpt b/ext/intl/tests/cpbi_parts_iterator.phpt index 82fea6f6e1..329c88c8b9 100644 --- a/ext/intl/tests/cpbi_parts_iterator.phpt +++ b/ext/intl/tests/cpbi_parts_iterator.phpt @@ -15,8 +15,8 @@ $it = IntlBreakIterator::createCodePointInstance()->getPartsIterator(); $it->getBreakIterator()->setText($text); foreach ($it as $k => $v) { - echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . - ") at {$it->getBreakIterator()->current()}\r\n"; + echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) . + ") at {$it->getBreakIterator()->current()}\r\n"; } ?> diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt index 1b346abf67..086bc01340 100644 --- a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt +++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt @@ -11,23 +11,23 @@ ini_set("intl.default_locale", "pt_PT"); ini_set("date.timezone", 'Atlantic/Azores'); function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone')); + var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone')); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3)); + var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } try { - var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass)); + var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass)); } catch (IntlException $e) { - print_exception($e); + print_exception($e); } ?> --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt index 83c256b713..1483f61058 100644 --- a/ext/intl/tests/dateformat_calendars.phpt +++ b/ext/intl/tests/dateformat_calendars.phpt @@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars_variant2.phpt b/ext/intl/tests/dateformat_calendars_variant2.phpt index 8d051abe59..895d39094a 100644 --- a/ext/intl/tests/dateformat_calendars_variant2.phpt +++ b/ext/intl/tests/dateformat_calendars_variant2.phpt @@ -12,29 +12,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_calendars_variant3.phpt b/ext/intl/tests/dateformat_calendars_variant3.phpt index 65597d6b45..99e153e290 100644 --- a/ext/intl/tests/dateformat_calendars_variant3.phpt +++ b/ext/intl/tests/dateformat_calendars_variant3.phpt @@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> ini_set("intl.error_level", E_WARNING); $fmt1 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); $fmt2 = new IntlDateFormatter('en_US', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::GREGORIAN); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::GREGORIAN); $fmt3 = new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - IntlDateFormatter::TRADITIONAL); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + IntlDateFormatter::TRADITIONAL); var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000'))); var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000'))); new IntlDateFormatter('en_US@calendar=hebrew', - IntlDateFormatter::FULL, - IntlDateFormatter::FULL, - 'GMT+05:12', - -1); + IntlDateFormatter::FULL, + IntlDateFormatter::FULL, + 'GMT+05:12', + -1); ?> ==DONE== --EXPECTF-- diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt index f9791004f3..3425a1b0f8 100644 --- a/ext/intl/tests/dateformat_clone_bad_obj.phpt +++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed IntlDateFormatter <?php class A extends IntlDateFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECTF-- string(%s) "Cannot clone unconstructed IntlDateFormatter" diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 5b121558a0..9cdb69b848 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt index 68f54eb7e7..ac7c5f8df9 100644 --- a/ext/intl/tests/dateformat_format_parse.phpt +++ b/ext/intl/tests/dateformat_format_parse.phpt @@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code() function ut_main() { - $timezone = 'GMT+05:00'; + $timezone = 'GMT+05:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM @@ -28,34 +28,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000, - -2200000000, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 7, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000, + -2200000000, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -64,72 +64,72 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - //Test format and parse with a timestamp : long - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - $parsed = ut_datefmt_parse( $fmt , $formatted); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nParsed timestamp is : $parsed"; - }else{ - $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; - } - } - } - } - - //Test format and parse with a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - //Parsing - $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); - - if( $parsed_arr){ - $res_str .= "\nParsed array is: "; - foreach( $parsed_arr as $key => $value){ - $res_str .= "$key : '$value' , "; - } - } + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } /* - else{ - //$res_str .= "No values found from LocaleTime parsing."; - $res_str .= "\tError : '".intl_get_error_message()."'"; - } + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } */ - } - } - } + } + } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_parse_version2.phpt b/ext/intl/tests/dateformat_format_parse_version2.phpt index f672cd6d22..1820e52e91 100644 --- a/ext/intl/tests/dateformat_format_parse_version2.phpt +++ b/ext/intl/tests/dateformat_format_parse_version2.phpt @@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code() function ut_main() { - $timezone = 'GMT+05:00'; + $timezone = 'GMT+05:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM @@ -28,34 +28,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000, - -2200000000, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 7, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000, + -2200000000, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 7, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -64,72 +64,72 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - //Test format and parse with a timestamp : long - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - $parsed = ut_datefmt_parse( $fmt , $formatted); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nParsed timestamp is : $parsed"; - }else{ - $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; - } - } - } - } - - //Test format and parse with a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + //Test format and parse with a timestamp : long + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + $parsed = ut_datefmt_parse( $fmt , $formatted); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nParsed timestamp is : $parsed"; + }else{ + $res_str .= "\nError while parsing as: '".intl_get_error_message()."'"; + } + } + } + } + + //Test format and parse with a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - //Parsing - $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); - - if( $parsed_arr){ - $res_str .= "\nParsed array is: "; - foreach( $parsed_arr as $key => $value){ - $res_str .= "$key : '$value' , "; - } - } + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + //Parsing + $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 ); + + if( $parsed_arr){ + $res_str .= "\nParsed array is: "; + foreach( $parsed_arr as $key => $value){ + $res_str .= "$key : '$value' , "; + } + } /* - else{ - //$res_str .= "No values found from LocaleTime parsing."; - $res_str .= "\tError : '".intl_get_error_message()."'"; - } + else{ + //$res_str .= "No values found from LocaleTime parsing."; + $res_str .= "\tError : '".intl_get_error_message()."'"; + } */ - } - } - } + } + } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt index d61b20b03a..b02cfcd9e6 100644 --- a/ext/intl/tests/dateformat_format_variant2.phpt +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt index e2f9ec81b0..52705a3f03 100644 --- a/ext/intl/tests/dateformat_format_variant3.phpt +++ b/ext/intl/tests/dateformat_format_variant3.phpt @@ -15,13 +15,13 @@ datefmt_format_code() function ut_main() { - $timezone = 'GMT-10:00'; + $timezone = 'GMT-10:00'; - $locale_arr = array ( - 'en_US' - ); + $locale_arr = array ( + 'en_US' + ); - $datetype_arr = array ( + $datetype_arr = array ( IntlDateFormatter::FULL, IntlDateFormatter::LONG, IntlDateFormatter::MEDIUM, @@ -32,34 +32,34 @@ function ut_main() $res_str = ''; - $time_arr = array ( - 0, - -1200000, - 1200000, - 2200000000.0, - -2200000000.0, - 90099999, - 3600, - -3600 - ); - - $localtime_arr1 = array ( - 'tm_sec' => 24 , - 'tm_min' => 3, - 'tm_hour' => 19, - 'tm_mday' => 3, - 'tm_mon' => 3, - 'tm_year' => 105, - ); - $localtime_arr2 = array ( - 'tm_sec' => 21, - 'tm_min' => 5, - 'tm_hour' => 7, - 'tm_mday' => 13, - 'tm_mon' => 4, - 'tm_year' => 205, - ); - $localtime_arr3 = array ( + $time_arr = array ( + 0, + -1200000, + 1200000, + 2200000000.0, + -2200000000.0, + 90099999, + 3600, + -3600 + ); + + $localtime_arr1 = array ( + 'tm_sec' => 24 , + 'tm_min' => 3, + 'tm_hour' => 19, + 'tm_mday' => 3, + 'tm_mon' => 3, + 'tm_year' => 105, + ); + $localtime_arr2 = array ( + 'tm_sec' => 21, + 'tm_min' => 5, + 'tm_hour' => 7, + 'tm_mday' => 13, + 'tm_mon' => 4, + 'tm_year' => 205, + ); + $localtime_arr3 = array ( 'tm_sec' => 11, 'tm_min' => 13, 'tm_hour' => 0, @@ -68,80 +68,80 @@ function ut_main() 'tm_year' => -5 ); - $localtime_arr = array ( - $localtime_arr1, - $localtime_arr2, - $localtime_arr3 - ); - - $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); - $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); - $d2->setTimezone(new DateTimeZone("PDT")); - $dates = array( - $d1, - $d2, - new StdClass(), - ); - - //Test format with input as a timestamp : integer - foreach( $time_arr as $timestamp_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput timestamp is : $timestamp_entry"; - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); - $formatted = ut_datefmt_format( $fmt , $timestamp_entry); - $res_str .= "\nFormatted timestamp is : $formatted"; - } - } - } - - //Test format with input as a localtime :array - foreach( $localtime_arr as $localtime_entry){ - $res_str .= "\n------------\n"; - $res_str .= "\nInput localtime is : "; - foreach( $localtime_entry as $key => $value){ + $localtime_arr = array ( + $localtime_arr1, + $localtime_arr2, + $localtime_arr3 + ); + + $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC")); + $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC")); + $d2->setTimezone(new DateTimeZone("PDT")); + $dates = array( + $d1, + $d2, + new StdClass(), + ); + + //Test format with input as a timestamp : integer + foreach( $time_arr as $timestamp_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput timestamp is : $timestamp_entry"; + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN); + $formatted = ut_datefmt_format( $fmt , $timestamp_entry); + $res_str .= "\nFormatted timestamp is : $formatted"; + } + } + } + + //Test format with input as a localtime :array + foreach( $localtime_arr as $localtime_entry){ + $res_str .= "\n------------\n"; + $res_str .= "\nInput localtime is : "; + foreach( $localtime_entry as $key => $value){ $res_str .= "$key : '$value' , "; - } - - $res_str .= "\n------------\n"; - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted localtime_array is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - foreach($dates as $date_entry) { - foreach( $locale_arr as $locale_entry ){ - foreach( $datetype_arr as $datetype_entry ) { - $res_str .= "\n------------"; - $res_str .= "\nDate is: ".var_export($date_entry, true); - $res_str .= "\n------------"; - - $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); - $formatted1 = ut_datefmt_format( $fmt , $date_entry); - if( intl_get_error_code() == U_ZERO_ERROR){ - $res_str .= "\nFormatted DateTime is : $formatted1"; - }else{ - $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; - } - } - } - } - - return $res_str; + } + + $res_str .= "\n------------\n"; + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry "; + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $localtime_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted localtime_array is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + foreach($dates as $date_entry) { + foreach( $locale_arr as $locale_entry ){ + foreach( $datetype_arr as $datetype_entry ) { + $res_str .= "\n------------"; + $res_str .= "\nDate is: ".var_export($date_entry, true); + $res_str .= "\n------------"; + + $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN ); + $formatted1 = ut_datefmt_format( $fmt , $date_entry); + if( intl_get_error_code() == U_ZERO_ERROR){ + $res_str .= "\nFormatted DateTime is : $formatted1"; + }else{ + $res_str .= "\nError while formatting as: '".intl_get_error_message()."'"; + } + } + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt index ec03bb68f4..27c9188d10 100644 --- a/ext/intl/tests/dateformat_get_datetype.phpt +++ b/ext/intl/tests/dateformat_get_datetype.phpt @@ -12,26 +12,26 @@ datefmt_get_datetype_code() function ut_main() { - $datetype_arr = array ( - IntlDateFormatter::FULL, - IntlDateFormatter::LONG, - IntlDateFormatter::MEDIUM, - IntlDateFormatter::SHORT, - IntlDateFormatter::NONE - ); - - $res_str = ''; - - foreach( $datetype_arr as $datetype_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry"; - $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $date_type = ut_datefmt_get_datetype( $fmt); - $res_str .= "\nAfter call to get_datetype : datetype= $date_type"; - $res_str .= "\n"; - } - - return $res_str; + $datetype_arr = array ( + IntlDateFormatter::FULL, + IntlDateFormatter::LONG, + IntlDateFormatter::MEDIUM, + IntlDateFormatter::SHORT, + IntlDateFormatter::NONE + ); + + $res_str = ''; + + foreach( $datetype_arr as $datetype_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry"; + $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $date_type = ut_datefmt_get_datetype( $fmt); + $res_str .= "\nAfter call to get_datetype : datetype= $date_type"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt index aa7a0a46c3..2078c7b6db 100644 --- a/ext/intl/tests/dateformat_get_locale.phpt +++ b/ext/intl/tests/dateformat_get_locale.phpt @@ -14,31 +14,31 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only'); function ut_main() { - $locale_arr = array ( - 'de-DE', - 'sl-IT-nedis', - 'en_UK', - 'hi' - ); - - $res_str = ''; - - foreach( $locale_arr as $locale_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry"; - $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $locale = ut_datefmt_get_locale( $fmt , 1); - $res_str .= "\nAfter call to get_locale : locale= $locale"; - $res_str .= "\n"; - } - $badvals = array(100, -1, 4294901761); - foreach($badvals as $badval) { - if(ut_datefmt_get_locale($fmt, $badval)) { - $res_str .= "datefmt_get_locale should return false for bad argument $badval\n"; - } - } - - return $res_str; + $locale_arr = array ( + 'de-DE', + 'sl-IT-nedis', + 'en_UK', + 'hi' + ); + + $res_str = ''; + + foreach( $locale_arr as $locale_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry"; + $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $locale = ut_datefmt_get_locale( $fmt , 1); + $res_str .= "\nAfter call to get_locale : locale= $locale"; + $res_str .= "\n"; + } + $badvals = array(100, -1, 4294901761); + foreach($badvals as $badval) { + if(ut_datefmt_get_locale($fmt, $badval)) { + $res_str .= "datefmt_get_locale should return false for bad argument $badval\n"; + } + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_set_pattern2.phpt b/ext/intl/tests/dateformat_get_set_pattern2.phpt index b741906ad6..11a5899883 100644 --- a/ext/intl/tests/dateformat_get_set_pattern2.phpt +++ b/ext/intl/tests/dateformat_get_set_pattern2.phpt @@ -14,7 +14,7 @@ function ut_main() { $pattern_arr = array ( 'DD-MM-YYYY hh:mm:ss', - 'yyyy-DDD.hh:mm:ss z', + 'yyyy-DDD.hh:mm:ss z', "yyyy/MM/dd", "yyyyMMdd" ); @@ -27,8 +27,8 @@ function ut_main() $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern ); $pattern = ut_datefmt_get_pattern( $fmt); $res_str .= "\nAfter call to get_pattern : pattern= $pattern"; - $formatted = ut_datefmt_format($fmt,0); - $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted"; + $formatted = ut_datefmt_format($fmt,0); + $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted"; foreach( $pattern_arr as $pattern_entry ) @@ -38,7 +38,7 @@ function ut_main() ut_datefmt_set_pattern( $fmt , $pattern_entry ); $pattern = ut_datefmt_get_pattern( $fmt); $res_str .= "\nAfter call to get_pattern : pattern= $pattern"; - $formatted = ut_datefmt_format($fmt,0); + $formatted = ut_datefmt_format($fmt,0); $res_str .= "\nResult of formatting timestamp=0 with the new pattern is : \n$formatted"; $res_str .= "\n"; diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt index cca3c6f96a..59a8f5e112 100644 --- a/ext/intl/tests/dateformat_get_timetype.phpt +++ b/ext/intl/tests/dateformat_get_timetype.phpt @@ -12,26 +12,26 @@ datefmt_get_timetype_code() function ut_main() { - $timetype_arr = array ( - IntlDateFormatter::FULL, - IntlDateFormatter::LONG, - IntlDateFormatter::MEDIUM, - IntlDateFormatter::SHORT, - IntlDateFormatter::NONE - ); - - $res_str = ''; - - foreach( $timetype_arr as $timetype_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry"; - $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); - $time_type = ut_datefmt_get_timetype( $fmt); - $res_str .= "\nAfter call to get_timetype : timetype= $time_type"; - $res_str .= "\n"; - } - - return $res_str; + $timetype_arr = array ( + IntlDateFormatter::FULL, + IntlDateFormatter::LONG, + IntlDateFormatter::MEDIUM, + IntlDateFormatter::SHORT, + IntlDateFormatter::NONE + ); + + $res_str = ''; + + foreach( $timetype_arr as $timetype_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry"; + $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN ); + $time_type = ut_datefmt_get_timetype( $fmt); + $res_str .= "\nAfter call to get_timetype : timetype= $time_type"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt index f529614f21..2df0ba40b1 100644 --- a/ext/intl/tests/dateformat_get_timezone_id.phpt +++ b/ext/intl/tests/dateformat_get_timezone_id.phpt @@ -15,24 +15,24 @@ intl.error_level=E_WARNING function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'US/Pacific', - 'US/Central' - ); - - $res_str = ''; - - foreach( $timezone_id_arr as $timezone_id_entry ) - { - $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry"; - $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt); - $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id"; - $res_str .= "\n"; - } - - return $res_str; + $timezone_id_arr = array ( + 'America/New_York', + 'US/Pacific', + 'US/Central' + ); + + $res_str = ''; + + foreach( $timezone_id_arr as $timezone_id_entry ) + { + $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry"; + $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt); + $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id"; + $res_str .= "\n"; + } + + return $res_str; } diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt index b78396b77f..4725ff8cb6 100644 --- a/ext/intl/tests/dateformat_is_set_lenient.phpt +++ b/ext/intl/tests/dateformat_is_set_lenient.phpt @@ -15,54 +15,54 @@ function ut_main() $res_str = ''; - //Create + //Create $fmt = ut_datefmt_create( "en-US", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT , 'America/New_York', IntlDateFormatter::GREGORIAN ); $res_str .= "\nIntlDateFormatter Created.\n"; $resLenient1 = ut_datefmt_is_lenient( $fmt); $res_str .= "After call to get_lenient : lenient= "; - if( $resLenient1){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + if( $resLenient1){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } - //Set and test + //Set and test $res_str .= "--------------------\n"; $isLenient = TRUE; - $res_str .= "Setting IntlDateFormatter with lenient = "; - if( $isLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } - ut_datefmt_set_lenient( $fmt , $isLenient ); - $resLenient = ut_datefmt_is_lenient( $fmt); - $res_str .= "After call to is_lenient : lenient= "; - if( $resLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + $res_str .= "Setting IntlDateFormatter with lenient = "; + if( $isLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } + ut_datefmt_set_lenient( $fmt , $isLenient ); + $resLenient = ut_datefmt_is_lenient( $fmt); + $res_str .= "After call to is_lenient : lenient= "; + if( $resLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } - //Set and test + //Set and test $res_str .= "--------------------\n"; $isLenient = FALSE; - $res_str .= "Setting IntlDateFormatter with lenient ="; - if( $isLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } - ut_datefmt_set_lenient( $fmt , $isLenient); - $resLenient = ut_datefmt_is_lenient( $fmt); - $res_str .= "After call to is_lenient : lenient= "; - if( $resLenient){ - $res_str .= "TRUE\n"; - }else{ - $res_str .= "FALSE\n"; - } + $res_str .= "Setting IntlDateFormatter with lenient ="; + if( $isLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } + ut_datefmt_set_lenient( $fmt , $isLenient); + $resLenient = ut_datefmt_is_lenient( $fmt); + $res_str .= "After call to is_lenient : lenient= "; + if( $resLenient){ + $res_str .= "TRUE\n"; + }else{ + $res_str .= "FALSE\n"; + } $res_str .= "--------------------\n"; diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 4f1724520c..b1fc00b875 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -17,37 +17,37 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' - ); - $timestamp_entry = 0; + $timezone_id_arr = array ( + 'America/New_York', + 'America/Los_Angeles', + 'America/Chicago', + 'CN' + ); + $timestamp_entry = 0; - $res_str = ''; + $res_str = ''; - $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; + $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) - { + foreach( $timezone_id_arr as $timezone_id_entry ) + { - $res_str .= "-----------"; - $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; - $formatted = ut_datefmt_format( $fmt, 0); - $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; - $formatted = ut_datefmt_format( $fmt, 3600); - $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; - $res_str .= "\n"; + $res_str .= "-----------"; + $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; + ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; + $formatted = ut_datefmt_format( $fmt, 0); + $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; + $formatted = ut_datefmt_format( $fmt, 3600); + $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; + $res_str .= "\n"; - } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt index 0970089bed..4eb963e186 100644 --- a/ext/intl/tests/dateformat_set_timezone_id3.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt @@ -17,37 +17,37 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { - $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' - ); - $timestamp_entry = 0; + $timezone_id_arr = array ( + 'America/New_York', + 'America/Los_Angeles', + 'America/Chicago', + 'CN' + ); + $timestamp_entry = 0; - $res_str = ''; + $res_str = ''; - $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; + $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) - { + foreach( $timezone_id_arr as $timezone_id_entry ) + { - $res_str .= "-----------"; - $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); - $timezone_id = ut_datefmt_get_timezone_id( $fmt ); - $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; - $formatted = ut_datefmt_format( $fmt, 0); - $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; - $formatted = ut_datefmt_format( $fmt, 3600); - $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; - $res_str .= "\n"; + $res_str .= "-----------"; + $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; + ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + $timezone_id = ut_datefmt_get_timezone_id( $fmt ); + $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; + $formatted = ut_datefmt_format( $fmt, 0); + $res_str .= "\nFormatting timestamp=0 resulted in $formatted"; + $formatted = ut_datefmt_format( $fmt, 3600); + $res_str .= "\nFormatting timestamp=3600 resulted in $formatted"; + $res_str .= "\n"; - } + } - return $res_str; + return $res_str; } diff --git a/ext/intl/tests/formatter_clone.phpt b/ext/intl/tests/formatter_clone.phpt index d474eb2b70..4ca2d44dc9 100644 --- a/ext/intl/tests/formatter_clone.phpt +++ b/ext/intl/tests/formatter_clone.phpt @@ -17,7 +17,7 @@ $fmt_clone = clone $fmt; $res = $fmt->setPattern("0.0" ); if( $res === false ) - $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n"; + $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; $res_str .= "Formatted(clone) number: " . ut_nfmt_format( $fmt_clone, $test_value ) . "\n"; diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt index 53a715e6a7..d27024cb39 100644 --- a/ext/intl/tests/formatter_clone_bad_obj.phpt +++ b/ext/intl/tests/formatter_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed numfmt <?php class A extends NumberFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECT-- string(42) "Cannot clone unconstructed NumberFormatter" diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt index 0a8d7f398b..4bce9184cc 100644 --- a/ext/intl/tests/formatter_fail.phpt +++ b/ext/intl/tests/formatter_fail.phpt @@ -6,82 +6,82 @@ numfmt creation failures <?php function err($fmt) { - if(!$fmt) { - echo var_export(intl_get_error_message(), true)."\n"; - } + if(!$fmt) { + echo var_export(intl_get_error_message(), true)."\n"; + } } function print_exception($e) { - echo "\n" . get_class($e) . ": " . $e->getMessage() + echo "\n" . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { - switch(true) { - case $t == "O": - try { - return new NumberFormatter($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "C": - try { - return NumberFormatter::create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "P": - try { - return numfmt_create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - } + switch(true) { + case $t == "O": + try { + return new NumberFormatter($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "C": + try { + return NumberFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "P": + try { + return numfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + } } $args = array( - array(null, null), - array("whatever", 1234567), - array(array(), array()), - array("en", -1), - array("en_US", NumberFormatter::PATTERN_RULEBASED), + array(null, null), + array("whatever", 1234567), + array(array(), array()), + array("en", -1), + array("en_US", NumberFormatter::PATTERN_RULEBASED), ); try { - $fmt = new NumberFormatter(); + $fmt = new NumberFormatter(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = numfmt_create(); + $fmt = numfmt_create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = NumberFormatter::create(); + $fmt = NumberFormatter::create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); foreach($args as $arg) { - $fmt = crt("O", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("C", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("P", $arg[0], $arg[1]); - err($fmt); + $fmt = crt("O", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("C", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("P", $arg[0], $arg[1]); + err($fmt); } ?> diff --git a/ext/intl/tests/formatter_format2.phpt b/ext/intl/tests/formatter_format2.phpt index 26ef060ea0..d6e06cb57c 100644 --- a/ext/intl/tests/formatter_format2.phpt +++ b/ext/intl/tests/formatter_format2.phpt @@ -52,10 +52,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format3.phpt b/ext/intl/tests/formatter_format3.phpt index b9d6eb5c3d..19512acc41 100644 --- a/ext/intl/tests/formatter_format3.phpt +++ b/ext/intl/tests/formatter_format3.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format4.phpt b/ext/intl/tests/formatter_format4.phpt index 96dd7be53e..0cc086b31e 100644 --- a/ext/intl/tests/formatter_format4.phpt +++ b/ext/intl/tests/formatter_format4.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format5.phpt b/ext/intl/tests/formatter_format5.phpt index 0bc4a6679b..8399af1129 100644 --- a/ext/intl/tests/formatter_format5.phpt +++ b/ext/intl/tests/formatter_format5.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format6.phpt b/ext/intl/tests/formatter_format6.phpt index 70703785c1..6244a7f290 100644 --- a/ext/intl/tests/formatter_format6.phpt +++ b/ext/intl/tests/formatter_format6.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format7.phpt b/ext/intl/tests/formatter_format7.phpt index 13d58bdd51..453a16e2b5 100644 --- a/ext/intl/tests/formatter_format7.phpt +++ b/ext/intl/tests/formatter_format7.phpt @@ -53,10 +53,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_format8.phpt b/ext/intl/tests/formatter_format8.phpt index 3aad6bced1..dcf8d8bca9 100644 --- a/ext/intl/tests/formatter_format8.phpt +++ b/ext/intl/tests/formatter_format8.phpt @@ -52,10 +52,10 @@ function ut_main() { $fmt = ut_nfmt_create( $locale, $style, $pattern ); - if(!$fmt) { - $str_res .= "Bad formatter!\n"; - continue; - } + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; } } diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt index 66d6837d75..441a8ecb15 100644 --- a/ext/intl/tests/formatter_get_set_pattern.phpt +++ b/ext/intl/tests/formatter_get_set_pattern.phpt @@ -33,8 +33,8 @@ function ut_main() $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; - ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); - $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; + ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); + $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; return $res_str; diff --git a/ext/intl/tests/formatter_get_set_pattern2.phpt b/ext/intl/tests/formatter_get_set_pattern2.phpt index b1d1ad0c48..f15c3bf75c 100644 --- a/ext/intl/tests/formatter_get_set_pattern2.phpt +++ b/ext/intl/tests/formatter_get_set_pattern2.phpt @@ -33,8 +33,8 @@ function ut_main() $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; - ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); - $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; + ut_nfmt_set_pattern($fmt, str_repeat('@', 200)); + $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n"; $res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n"; return $res_str; diff --git a/ext/intl/tests/formatter_get_set_symbol2.phpt b/ext/intl/tests/formatter_get_set_symbol2.phpt index 201a4f6872..f4435c278a 100644 --- a/ext/intl/tests/formatter_get_set_symbol2.phpt +++ b/ext/intl/tests/formatter_get_set_symbol2.phpt @@ -13,7 +13,7 @@ numfmt_get/set_symbol() icu >= 4.8 function ut_main() { - $longstr = str_repeat("blah", 10); + $longstr = str_repeat("blah", 10); $symbols = array( 'DECIMAL_SEPARATOR_SYMBOL' => array( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '_._', 12345.123456, NumberFormatter::DECIMAL ), 'GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '_,_', 12345.123456, NumberFormatter::DECIMAL ), @@ -33,8 +33,8 @@ function ut_main() 'NAN_SYMBOL' => array( NumberFormatter::NAN_SYMBOL, '_N_', 12345.123456, NumberFormatter::DECIMAL ), 'SIGNIFICANT_DIGIT_SYMBOL' => array( NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, '_SD_', 12345.123456, NumberFormatter::DECIMAL ), 'MONETARY_GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, '_MG_', 12345.123456, NumberFormatter::CURRENCY ), - 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, " ", 12345.123456, NumberFormatter::CURRENCY ), - 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ), + 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, " ", 12345.123456, NumberFormatter::CURRENCY ), + 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ), ); $res_str = ''; @@ -76,9 +76,9 @@ function ut_main() } $badvals = array(2147483648, -2147483648, -1, 4294901761); foreach($badvals as $badval) { - if(ut_nfmt_get_symbol( $fmt, 2147483648 )) { - $res_str .= "Bad value $badval should return false!\n"; - } + if(ut_nfmt_get_symbol( $fmt, 2147483648 )) { + $res_str .= "Bad value $badval should return false!\n"; + } } return $res_str; } diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt index dea3c2d36f..b3ae867b24 100644 --- a/ext/intl/tests/formatter_get_set_text_attribute.phpt +++ b/ext/intl/tests/formatter_get_set_text_attribute.phpt @@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU < 56.1 function ut_main() { // Array with data for testing - $long_str = str_repeat('blah', 100); + $long_str = str_repeat('blah', 100); $attributes = array( 'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ), 'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ), 'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ), 'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ), 'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ), - 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), + 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), // 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 ) // 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ), // 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 ) diff --git a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt index 260e33a350..3819de6dde 100644 --- a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt +++ b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt @@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU >= 56.1 function ut_main() { // Array with data for testing - $long_str = str_repeat('blah', 100); + $long_str = str_repeat('blah', 100); $attributes = array( 'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ), 'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ), 'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ), 'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ), 'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ), - 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), + 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ), // 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 ) // 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ), // 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 ) diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt index 9e14d9cc14..be82abf718 100644 --- a/ext/intl/tests/grapheme.phpt +++ b/ext/intl/tests/grapheme.phpt @@ -12,772 +12,772 @@ grapheme() function ut_main() { - $res_str = ''; - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - // the word 'hindi' using Devanagari characters: - $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; - - $char_a_ring_nfd = "a\xCC\x8A"; - $char_A_ring_nfd = "A\xCC\x8A"; - $char_o_diaeresis_nfd = "o\xCC\x88"; - $char_O_diaeresis_nfd = "O\xCC\x88"; - $char_diaeresis = "\xCC\x88"; - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; - - - $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; - $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; - $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; - $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; - $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; - $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "abc", "a", -1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "ABabc", "AB", -4, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_stripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_stripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strrpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strrpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; - - $tests = array( - - array( "abc", 3, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), - array( "Abc", -5, "false" ), - array( $char_a_ring_nfd . "bc", 3, "false" ), - array( "abc", 4, "false" ), - array( "abC", 2, "C" ), - array( "abc", 1, "bc" ), - array( "Abc", 1, 1, "b" ), - array( "abc", 0, 2, "ab" ), - array( "Abc", -4, 1, "false" ), - array( "ababc", 1, 2, "ba" ), - array( "ababc", 0, 10, "ababc" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; - if ( 3 == count( $test ) ) { - $result = grapheme_substr($test[0], $test[1]); - } - else { - $res_str .= " with length $test[2]"; - $result = grapheme_substr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", "c" ), - array( "abc", "b", "bc" ), - array( "abc", "a", "abc" ), - array( "abc", "ab", "abc" ), - array( "abc", "abc", "abc" ), - array( "abc", "bc", "bc" ), - array( "abc", "a", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "abc", "b", TRUE, "a" ), - array( "abc", "c", TRUE, "ab" ), - array( "ababc", "bab", TRUE, "a" ), - array( "ababc", "abc", TRUE, "ab" ), - array( "ababc", "abc", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), - array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "ab", "abc" ), - array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), - array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), - array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; - if ( 3 == count( $test ) ) { - $result = grapheme_strstr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_strstr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "d", "false" ), - array( "abc", "C", "c" ), - array( "aBc", "b", "Bc" ), - array( "abc", "A", "abc" ), - array( "abC", "ab", "abC" ), - array( "abc", "aBc", "abc" ), - array( "abC", "bc", "bC" ), - array( "abc", "A", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "aBc", "b", TRUE, "a" ), - array( "abc", "C", TRUE, "ab" ), - array( "aBabc", "bab", TRUE, "a" ), - array( "ababc", "aBc", TRUE, "ab" ), - array( "ababc", "abC", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), - array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), - array( $char_A_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "Ab", "abc" ), - array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), - array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), - array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; - if ( 3 == count( $test ) ) { - $result = grapheme_stristr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_stristr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; - - $tests = array( - // haystack, count, [[offset], [next]], result - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc", 1, 0, "a" ), - array( "abc", 1, 1, "b" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 2, "" ), - - array( "abc", 3, 0, 3, "abc" ), - array( "abc", 2, 0, 2, "ab" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 0, 0, 0, "" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 1, 1, 2, "b" ), - array( "abc", 1, 2, 3, "c" ), - array( "abc", 1, -2, 2, "b" ), - array( "abc", 0, 2, 2, "" ), + $res_str = ''; + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + // the word 'hindi' using Devanagari characters: + $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; + + $char_a_ring_nfd = "a\xCC\x8A"; + $char_A_ring_nfd = "A\xCC\x8A"; + $char_o_diaeresis_nfd = "o\xCC\x88"; + $char_O_diaeresis_nfd = "O\xCC\x88"; + $char_diaeresis = "\xCC\x88"; + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; + + + $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; + $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; + $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; + $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; + $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; + $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "abc", "a", -1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "ABabc", "AB", -4, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_stripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_stripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strrpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strrpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; + + $tests = array( + + array( "abc", 3, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), + array( "Abc", -5, "false" ), + array( $char_a_ring_nfd . "bc", 3, "false" ), + array( "abc", 4, "false" ), + array( "abC", 2, "C" ), + array( "abc", 1, "bc" ), + array( "Abc", 1, 1, "b" ), + array( "abc", 0, 2, "ab" ), + array( "Abc", -4, 1, "false" ), + array( "ababc", 1, 2, "ba" ), + array( "ababc", 0, 10, "ababc" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; + if ( 3 == count( $test ) ) { + $result = grapheme_substr($test[0], $test[1]); + } + else { + $res_str .= " with length $test[2]"; + $result = grapheme_substr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", "c" ), + array( "abc", "b", "bc" ), + array( "abc", "a", "abc" ), + array( "abc", "ab", "abc" ), + array( "abc", "abc", "abc" ), + array( "abc", "bc", "bc" ), + array( "abc", "a", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "abc", "b", TRUE, "a" ), + array( "abc", "c", TRUE, "ab" ), + array( "ababc", "bab", TRUE, "a" ), + array( "ababc", "abc", TRUE, "ab" ), + array( "ababc", "abc", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), + array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "ab", "abc" ), + array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), + array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), + array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; + if ( 3 == count( $test ) ) { + $result = grapheme_strstr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_strstr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "d", "false" ), + array( "abc", "C", "c" ), + array( "aBc", "b", "Bc" ), + array( "abc", "A", "abc" ), + array( "abC", "ab", "abC" ), + array( "abc", "aBc", "abc" ), + array( "abC", "bc", "bC" ), + array( "abc", "A", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "aBc", "b", TRUE, "a" ), + array( "abc", "C", TRUE, "ab" ), + array( "aBabc", "bab", TRUE, "a" ), + array( "ababc", "aBc", TRUE, "ab" ), + array( "ababc", "abC", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), + array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), + array( $char_A_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "Ab", "abc" ), + array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), + array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), + array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; + if ( 3 == count( $test ) ) { + $result = grapheme_stristr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_stristr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; + + $tests = array( + // haystack, count, [[offset], [next]], result + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc", 1, 0, "a" ), + array( "abc", 1, 1, "b" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 2, "" ), + + array( "abc", 3, 0, 3, "abc" ), + array( "abc", 2, 0, 2, "ab" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 0, 0, 0, "" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 1, 1, 2, "b" ), + array( "abc", 1, 2, 3, "c" ), + array( "abc", 1, -2, 2, "b" ), + array( "abc", 0, 2, 2, "" ), array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ), - array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), - array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), - - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - $next = -1; - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1]); - } - elseif ( 4 == count ( $test ) ) { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); - } - else { - $res_str .= " starting at byte position $test[2] with \$next"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); - if ( 5 == count ( $test ) ) { - $res_str .= " \$next=$next == $test[3] "; - if ( $next != $test[3] ) { - $res_str .= "***FAILED***"; - } - } - $res_str .= "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), - array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), - array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), - array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . "abc", 0, "" ), - array( $char_o_diaeresis_nfd . "abc", 1, "" ), - array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), - array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - - array( "abc", 3, 0, "abc" ), - array( "abc", 2, 1, "bc" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 3, "false" ), - array( "abc", 1, 3, "false" ), - array( "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - - return $res_str; + array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), + array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), + + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + $next = -1; + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1]); + } + elseif ( 4 == count ( $test ) ) { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); + } + else { + $res_str .= " starting at byte position $test[2] with \$next"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); + if ( 5 == count ( $test ) ) { + $res_str .= " \$next=$next == $test[3] "; + if ( $next != $test[3] ) { + $res_str .= "***FAILED***"; + } + } + $res_str .= "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), + array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), + array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), + array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . "abc", 0, "" ), + array( $char_o_diaeresis_nfd . "abc", 1, "" ), + array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), + array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + + array( "abc", 3, 0, "abc" ), + array( "abc", 2, 1, "bc" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 3, "false" ), + array( "abc", 1, 3, "false" ), + array( "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + + return $res_str; } echo ut_main(); function check_result($result, $expected) { - if ( $result === false ) { - $result = 'false'; - } + if ( $result === false ) { + $result = 'false'; + } - if ( strcmp($result, $expected) != 0 ) { - return " **FAILED** "; - } + if ( strcmp($result, $expected) != 0 ) { + return " **FAILED** "; + } - return ""; + return ""; } ?> diff --git a/ext/intl/tests/grapheme2.phpt b/ext/intl/tests/grapheme2.phpt index e17b53b094..4595b78128 100644 --- a/ext/intl/tests/grapheme2.phpt +++ b/ext/intl/tests/grapheme2.phpt @@ -12,772 +12,772 @@ grapheme() function ut_main() { - $res_str = ''; - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - // the word 'hindi' using Devanagari characters: - $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; - - $char_a_ring_nfd = "a\xCC\x8A"; - $char_A_ring_nfd = "A\xCC\x8A"; - $char_o_diaeresis_nfd = "o\xCC\x88"; - $char_O_diaeresis_nfd = "O\xCC\x88"; - $char_diaeresis = "\xCC\x88"; - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; - - - $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; - $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; - $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; - $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; - $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; - $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "abc", "a", -1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "ABabc", "AB", -4, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_stripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_stripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", 2 ), - array( "abc", "b", 1 ), - array( "abc", "a", 0 ), - array( "abc", "a", 0, 0 ), - array( "abc", "a", 1, "false" ), - array( "ababc", "a", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "bc", "false" ), - array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), - array( "abc", "defghijklmnopq", "false" ), - array( "abc", "ab", 0 ), - array( "abc", "bc", 1 ), - array( "abc", "abc", 0 ), - array( "abc", "abcd", "false" ), - array( "abc", "ab", 0, 0 ), - array( "abc", "abc", 0, 0 ), - array( "abc", "abc", 1, "false" ), - array( "ababc", "ab", 1, 2 ), - array( "ababc", "abc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strrpos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strrpos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; - - $tests = array( - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), - array( "Abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "D", "false" ), - array( "abC", "c", 2 ), - array( "abc", "B", 1 ), - array( "Abc", "a", 0 ), - array( "abc", "A", 0, 0 ), - array( "Abc", "a", 1, "false" ), - array( "ababc", "A", 1, 2 ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), - array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), - array( "abc", $char_a_ring_nfd . "BC", "false" ), - array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), - array( "aBC", "Defghijklmnopq", "false" ), - array( "abC", "Ab", 0 ), - array( "aBC", "bc", 1 ), - array( "abC", "Abc", 0 ), - array( "abC", "aBcd", "false" ), - array( "ABc", "ab", 0, 0 ), - array( "aBc", "abC", 0, 0 ), - array( "abc", "aBc", 1, "false" ), - array( "ABabc", "AB", 1, 2 ), - array( "abaBc", "aBc", 1, 2 ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; - if ( 3 == count( $test ) ) { - $result = grapheme_strripos($test[0], $test[1]); - } - else { - $res_str .= " from $test[2]"; - $result = grapheme_strripos($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= $result; - } - $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; - - $tests = array( - - array( "abc", 3, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), - array( "Abc", -5, "false" ), - array( $char_a_ring_nfd . "bc", 3, "false" ), - array( "abc", 4, "false" ), - array( "abC", 2, "C" ), - array( "abc", 1, "bc" ), - array( "Abc", 1, 1, "b" ), - array( "abc", 0, 2, "ab" ), - array( "Abc", -4, 1, "false" ), - array( "ababc", 1, 2, "ba" ), - array( "ababc", 0, 10, "ababc" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), - - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; - if ( 3 == count( $test ) ) { - $result = grapheme_substr($test[0], $test[1]); - } - else { - $res_str .= " with length $test[2]"; - $result = grapheme_substr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( "abc", "d", "false" ), - array( "abc", "c", "c" ), - array( "abc", "b", "bc" ), - array( "abc", "a", "abc" ), - array( "abc", "ab", "abc" ), - array( "abc", "abc", "abc" ), - array( "abc", "bc", "bc" ), - array( "abc", "a", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "abc", "b", TRUE, "a" ), - array( "abc", "c", TRUE, "ab" ), - array( "ababc", "bab", TRUE, "a" ), - array( "ababc", "abc", TRUE, "ab" ), - array( "ababc", "abc", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), - array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), - array( $char_a_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "ab", "abc" ), - array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), - array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), - array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; - if ( 3 == count( $test ) ) { - $result = grapheme_strstr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_strstr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; - - $tests = array( - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), - array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), - array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), - array( "abc", $char_a_ring_nfd, "false" ), - array( $char_a_ring_nfd . "bc", "A", "false" ), - array( "abc", "d", "false" ), - array( "abc", "C", "c" ), - array( "aBc", "b", "Bc" ), - array( "abc", "A", "abc" ), - array( "abC", "ab", "abC" ), - array( "abc", "aBc", "abc" ), - array( "abC", "bc", "bC" ), - array( "abc", "A", FALSE, "abc" ), - array( "abc", "a", TRUE, "" ), - array( "aBc", "b", TRUE, "a" ), - array( "abc", "C", TRUE, "ab" ), - array( "aBabc", "bab", TRUE, "a" ), - array( "ababc", "aBc", TRUE, "ab" ), - array( "ababc", "abC", FALSE, "abc" ), - - array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), - array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), - array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), - array( $char_A_ring_nfd . "bc", "a", "false" ), - array( $char_a_ring_nfd . "abc", "Ab", "abc" ), - array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), - array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), - array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), - array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), - array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), - array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), - array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), - array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), - array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), - - ); - - foreach( $tests as $test ) { - $arg1 = urlencode($test[1]); - $arg0 = urlencode($test[0]); - $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; - if ( 3 == count( $test ) ) { - $result = grapheme_stristr($test[0], $test[1]); - } - else { - $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); - $result = grapheme_stristr($test[0], $test[1], $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; - - $tests = array( - // haystack, count, [[offset], [next]], result - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc", 1, 0, "a" ), - array( "abc", 1, 1, "b" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 2, "" ), - - array( "abc", 3, 0, 3, "abc" ), - array( "abc", 2, 0, 2, "ab" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 0, 0, 0, "" ), - array( "abc", 1, 0, 1, "a" ), - array( "abc", 1, 1, 2, "b" ), - array( "abc", 1, 2, 3, "c" ), - array( "abc", 1, -2, 2, "b" ), - array( "abc", 0, 2, 2, "" ), + $res_str = ''; + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + // the word 'hindi' using Devanagari characters: + $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80"; + + $char_a_ring_nfd = "a\xCC\x8A"; + $char_A_ring_nfd = "A\xCC\x8A"; + $char_o_diaeresis_nfd = "o\xCC\x88"; + $char_O_diaeresis_nfd = "O\xCC\x88"; + $char_diaeresis = "\xCC\x88"; + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n"; + + + $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n"; + $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n"; + $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n"; + $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n"; + $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n"; + $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n"; + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "abc", "a", -1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "ABabc", "AB", -4, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_stripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_stripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", 2 ), + array( "abc", "b", 1 ), + array( "abc", "a", 0 ), + array( "abc", "a", 0, 0 ), + array( "abc", "a", 1, "false" ), + array( "ababc", "a", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "bc", "false" ), + array( $char_a_ring_nfd . "bc", "abcdefg", "false" ), + array( "abc", "defghijklmnopq", "false" ), + array( "abc", "ab", 0 ), + array( "abc", "bc", 1 ), + array( "abc", "abc", 0 ), + array( "abc", "abcd", "false" ), + array( "abc", "ab", 0, 0 ), + array( "abc", "abc", 0, 0 ), + array( "abc", "abc", 1, "false" ), + array( "ababc", "ab", 1, 2 ), + array( "ababc", "abc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strrpos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strrpos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n"; + + $tests = array( + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ), + array( "Abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "D", "false" ), + array( "abC", "c", 2 ), + array( "abc", "B", 1 ), + array( "Abc", "a", 0 ), + array( "abc", "A", 0, 0 ), + array( "Abc", "a", 1, "false" ), + array( "ababc", "A", 1, 2 ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ), + array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ), + array( "abc", $char_a_ring_nfd . "BC", "false" ), + array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ), + array( "aBC", "Defghijklmnopq", "false" ), + array( "abC", "Ab", 0 ), + array( "aBC", "bc", 1 ), + array( "abC", "Abc", 0 ), + array( "abC", "aBcd", "false" ), + array( "ABc", "ab", 0, 0 ), + array( "aBc", "abC", 0, 0 ), + array( "abc", "aBc", 1, "false" ), + array( "ABabc", "AB", 1, 2 ), + array( "abaBc", "aBc", 1, 2 ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ), + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos"; + if ( 3 == count( $test ) ) { + $result = grapheme_strripos($test[0], $test[1]); + } + else { + $res_str .= " from $test[2]"; + $result = grapheme_strripos($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= $result; + } + $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n"; + + $tests = array( + + array( "abc", 3, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ), + array( "Abc", -5, "false" ), + array( $char_a_ring_nfd . "bc", 3, "false" ), + array( "abc", 4, "false" ), + array( "abC", 2, "C" ), + array( "abc", 1, "bc" ), + array( "Abc", 1, 1, "b" ), + array( "abc", 0, 2, "ab" ), + array( "Abc", -4, 1, "false" ), + array( "ababc", 1, 2, "ba" ), + array( "ababc", 0, 10, "ababc" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ), + + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr"; + if ( 3 == count( $test ) ) { + $result = grapheme_substr($test[0], $test[1]); + } + else { + $res_str .= " with length $test[2]"; + $result = grapheme_substr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( "abc", "d", "false" ), + array( "abc", "c", "c" ), + array( "abc", "b", "bc" ), + array( "abc", "a", "abc" ), + array( "abc", "ab", "abc" ), + array( "abc", "abc", "abc" ), + array( "abc", "bc", "bc" ), + array( "abc", "a", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "abc", "b", TRUE, "a" ), + array( "abc", "c", TRUE, "ab" ), + array( "ababc", "bab", TRUE, "a" ), + array( "ababc", "abc", TRUE, "ab" ), + array( "ababc", "abc", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "a", "a", "a" ), + array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ), + array( $char_a_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "ab", "abc" ), + array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ), + array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ), + array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr"; + if ( 3 == count( $test ) ) { + $result = grapheme_strstr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_strstr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n"; + + $tests = array( + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ), + array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ), + array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"), + array( "abc", $char_a_ring_nfd, "false" ), + array( $char_a_ring_nfd . "bc", "A", "false" ), + array( "abc", "d", "false" ), + array( "abc", "C", "c" ), + array( "aBc", "b", "Bc" ), + array( "abc", "A", "abc" ), + array( "abC", "ab", "abC" ), + array( "abc", "aBc", "abc" ), + array( "abC", "bc", "bC" ), + array( "abc", "A", FALSE, "abc" ), + array( "abc", "a", TRUE, "" ), + array( "aBc", "b", TRUE, "a" ), + array( "abc", "C", TRUE, "ab" ), + array( "aBabc", "bab", TRUE, "a" ), + array( "ababc", "aBc", TRUE, "ab" ), + array( "ababc", "abC", FALSE, "abc" ), + + array( "ab" . $char_a_ring_nfd . "c", "d", "false" ), + array( "bc" . $char_a_ring_nfd . "A", "a", "A" ), + array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ), + array( $char_A_ring_nfd . "bc", "a", "false" ), + array( $char_a_ring_nfd . "abc", "Ab", "abc" ), + array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd), + array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ), + array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ), + array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ), + array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ), + array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ), + array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ), + array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ), + array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ), + + ); + + foreach( $tests as $test ) { + $arg1 = urlencode($test[1]); + $arg0 = urlencode($test[0]); + $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr"; + if ( 3 == count( $test ) ) { + $result = grapheme_stristr($test[0], $test[1]); + } + else { + $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" ); + $result = grapheme_stristr($test[0], $test[1], $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n"; + + $tests = array( + // haystack, count, [[offset], [next]], result + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc", 1, 0, "a" ), + array( "abc", 1, 1, "b" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 2, "" ), + + array( "abc", 3, 0, 3, "abc" ), + array( "abc", 2, 0, 2, "ab" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 0, 0, 0, "" ), + array( "abc", 1, 0, 1, "a" ), + array( "abc", 1, 1, 2, "b" ), + array( "abc", 1, 2, 3, "c" ), + array( "abc", 1, -2, 2, "b" ), + array( "abc", 0, 2, 2, "" ), array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ), - array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), - array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), - array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), - array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), - - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - $next = -1; - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1]); - } - elseif ( 4 == count ( $test ) ) { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); - } - else { - $res_str .= " starting at byte position $test[2] with \$next"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); - if ( 5 == count ( $test ) ) { - $res_str .= " \$next=$next == $test[3] "; - if ( $next != $test[3] ) { - $res_str .= "***FAILED***"; - } - } - $res_str .= "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), - array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), - array( $char_a_ring_nfd . "bc", 1, "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), - array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), - - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), - array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; - - $tests = array( - array( "abc", 3, "abc" ), - array( "abc", 2, "ab" ), - array( "abc", 1, "a" ), - array( "abc", 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 0, "" ), - array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), - array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), - array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), - array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), - array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), - array( $char_o_diaeresis_nfd . "abc", 0, "" ), - array( $char_o_diaeresis_nfd . "abc", 1, "" ), - array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), - array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), - array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - - array( "abc", 3, 0, "abc" ), - array( "abc", 2, 1, "bc" ), - array( "abc", 1, 2, "c" ), - array( "abc", 0, 3, "false" ), - array( "abc", 1, 3, "false" ), - array( "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), - array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), - array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), - - ); - - foreach( $tests as $test ) { - $arg0 = urlencode($test[0]); - $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; - if ( 3 == count( $test ) ) { - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); - } - else { - $res_str .= " starting at byte position $test[2]"; - $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); - } - $res_str .= " = "; - if ( $result === false ) { - $res_str .= 'false'; - } - else { - $res_str .= urlencode($result); - } - $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; - } - - - //===================================================================================== - - return $res_str; + array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ), + array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ), + array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ), + array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ), + + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + $next = -1; + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1]); + } + elseif ( 4 == count ( $test ) ) { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]); + } + else { + $res_str .= " starting at byte position $test[2] with \$next"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]); + if ( 5 == count ( $test ) ) { + $res_str .= " \$next=$next == $test[3] "; + if ( $next != $test[3] ) { + $res_str .= "***FAILED***"; + } + } + $res_str .= "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ), + array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ), + array( $char_a_ring_nfd . "bc", 1, "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ), + array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis), + + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis), + array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n"; + + $tests = array( + array( "abc", 3, "abc" ), + array( "abc", 2, "ab" ), + array( "abc", 1, "a" ), + array( "abc", 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 0, "" ), + array( "abc" . $char_o_diaeresis_nfd, 1, "a" ), + array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ), + array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ), + array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd), + array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd), + array( $char_o_diaeresis_nfd . "abc", 0, "" ), + array( $char_o_diaeresis_nfd . "abc", 1, "" ), + array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ), + array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ), + array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + + array( "abc", 3, 0, "abc" ), + array( "abc", 2, 1, "bc" ), + array( "abc", 1, 2, "c" ), + array( "abc", 0, 3, "false" ), + array( "abc", 1, 3, "false" ), + array( "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ), + array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ), + array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ), + + ); + + foreach( $tests as $test ) { + $arg0 = urlencode($test[0]); + $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS"; + if ( 3 == count( $test ) ) { + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS); + } + else { + $res_str .= " starting at byte position $test[2]"; + $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]); + } + $res_str .= " = "; + if ( $result === false ) { + $res_str .= 'false'; + } + else { + $res_str .= urlencode($result); + } + $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n"; + } + + + //===================================================================================== + + return $res_str; } echo ut_main(); function check_result($result, $expected) { - if ( $result === false ) { - $result = 'false'; - } + if ( $result === false ) { + $result = 'false'; + } - if ( strcmp($result, $expected) != 0 ) { - return " **FAILED** "; - } + if ( strcmp($result, $expected) != 0 ) { + return " **FAILED** "; + } - return ""; + return ""; } ?> diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt index 2f468a12c5..41bfc49398 100644 --- a/ext/intl/tests/gregoriancalendar___construct_error.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt @@ -24,14 +24,14 @@ try { echo $e->getMessage(), "\n"; } try { - var_dump(new IntlGregorianCalendar(1,2,NULL,4)); + var_dump(new IntlGregorianCalendar(1,2,NULL,4)); } catch (ArgumentCountError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } try { - var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array())); + var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array())); } catch (TypeError $e) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } --EXPECT-- Too many arguments diff --git a/ext/intl/tests/idn_uts46_basic.phpt b/ext/intl/tests/idn_uts46_basic.phpt index 881e8311c9..5178c08d6c 100644 --- a/ext/intl/tests/idn_uts46_basic.phpt +++ b/ext/intl/tests/idn_uts46_basic.phpt @@ -13,14 +13,14 @@ $asciiNonTrans = "www.xn--fuball-cta.com"; echo "all ok, no details:", "\n"; var_dump(idn_to_ascii($utf8dn, - IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)); + IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)); echo "all ok, no details, transitional:", "\n"; var_dump(idn_to_ascii($utf8dn, 0, INTL_IDNA_VARIANT_UTS46)); echo "all ok, with details:", "\n"; var_dump(idn_to_ascii($utf8dn, IDNA_NONTRANSITIONAL_TO_ASCII, - INTL_IDNA_VARIANT_UTS46, $info)); + INTL_IDNA_VARIANT_UTS46, $info)); var_dump($info); echo "reverse, ok, with details:", "\n"; diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt index e468e8caf8..35aa1cb073 100644 --- a/ext/intl/tests/idn_uts46_errors.phpt +++ b/ext/intl/tests/idn_uts46_errors.phpt @@ -22,14 +22,14 @@ var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46)); echo "with error, with details arg:", "\n"; var_dump(idn_to_ascii("www.fußball.com-", IDNA_NONTRANSITIONAL_TO_ASCII, - INTL_IDNA_VARIANT_UTS46, $foo)); + INTL_IDNA_VARIANT_UTS46, $foo)); var_dump($foo); echo "with error, with details arg, contextj:", "\n"; var_dump(idn_to_ascii( - html_entity_decode("www.a‍b.com", 0, "UTF-8"), - IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ, - INTL_IDNA_VARIANT_UTS46, $foo)); + html_entity_decode("www.a‍b.com", 0, "UTF-8"), + IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ, + INTL_IDNA_VARIANT_UTS46, $foo)); var_dump($foo); var_dump($foo["errors"]==IDNA_ERROR_CONTEXTJ); diff --git a/ext/intl/tests/ini_use_exceptions_basic.phpt b/ext/intl/tests/ini_use_exceptions_basic.phpt index 36ccbcb8a0..8945c130eb 100644 --- a/ext/intl/tests/ini_use_exceptions_basic.phpt +++ b/ext/intl/tests/ini_use_exceptions_basic.phpt @@ -7,9 +7,9 @@ intl.use_exceptions INI setting ini_set("intl.use_exceptions", true); $t = transliterator_create('any-hex'); try { - var_dump($t->transliterate('a', 3)); + var_dump($t->transliterate('a', 3)); } catch (IntlException $intlE) { - var_dump($intlE->getMessage()); + var_dump($intlE->getMessage()); } ini_set("intl.use_exceptions", false); ini_set("intl.error_level", E_NOTICE); diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt index 6a29cd6723..ad1f64e708 100644 --- a/ext/intl/tests/locale_accept.phpt +++ b/ext/intl/tests/locale_accept.phpt @@ -12,19 +12,19 @@ locale_accept_from_http function ut_main() { - $res_str = ""; - $http_acc = array( - 'en-us,en;q=0.5', - 'da, en-gb;q=0.8, en;q=0.7', - 'zh, en-us;q=0.8, en;q=0.7', - 'xx, fr-FR;q=0.3, de-DE;q=0.5', - 'none', - ); + $res_str = ""; + $http_acc = array( + 'en-us,en;q=0.5', + 'da, en-gb;q=0.8, en;q=0.7', + 'zh, en-us;q=0.8, en;q=0.7', + 'xx, fr-FR;q=0.3, de-DE;q=0.5', + 'none', + ); foreach($http_acc as $http) { - $res = ut_loc_accept_http($http); - $res_str .= @"Accepting $http: $res\n"; - } + $res = ut_loc_accept_http($http); + $res_str .= @"Accepting $http: $res\n"; + } return $res_str; } diff --git a/ext/intl/tests/locale_bug72658.phpt b/ext/intl/tests/locale_bug72658.phpt index 4a68e2681b..6ac8048406 100644 --- a/ext/intl/tests/locale_bug72658.phpt +++ b/ext/intl/tests/locale_bug72658.phpt @@ -6,8 +6,8 @@ Bug #72658 Locale::lookup() / locale_lookup() hangs if no match found <?php var_dump( - Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'), - Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE') + Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'), + Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE') ); ?> diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt index 5eef05b3e6..e09e104c85 100644 --- a/ext/intl/tests/locale_compose_locale.phpt +++ b/ext/intl/tests/locale_compose_locale.phpt @@ -12,120 +12,120 @@ locale_compose_locale() function ut_main() { - $loc_parts_arr1 = array( - Locale::LANG_TAG =>'sl' , - Locale::SCRIPT_TAG =>'Latn' , - Locale::REGION_TAG =>'IT' - ); - $loc_parts_arr2 = array( - Locale::LANG_TAG =>'de' , - Locale::REGION_TAG =>'DE' - ); - $loc_parts_arr3 = array( - Locale::LANG_TAG =>'hi' - ); - $loc_parts_arr4 = array( - Locale::LANG_TAG =>'zh' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN' - ); - $loc_parts_arr5 = array( - Locale::LANG_TAG =>'es' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN' - ); - $loc_parts_arr6 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - Locale::VARIANT_TAG.'14' =>'rozaj' , - 'variant1'=>'nedis' - ); - $loc_parts_arr7 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - 'variant14'=>'rozaj' , - 'variant1'=>'nedis' , - 'extlang0'=>'lng' , - 'extlang1'=>'ing' - ); - $loc_parts_arr8 = array( - Locale::LANG_TAG =>'en' , - Locale::SCRIPT_TAG =>'Hans' , - Locale::REGION_TAG =>'CN', - 'variant14'=>'rozaj' , - 'variant1'=>'nedis' , - 'extlang0'=>'lng' , - 'extlang1'=>'ing', - 'private7'=>'prv1' , - 'private9'=>'prv2' - ); - $loc_parts_arr9 = array( - Locale::REGION_TAG =>'DE' - ); - $loc_parts_arr10 = array( - Locale::LANG_TAG => 45, - Locale::REGION_TAG => false, - Locale::SCRIPT_TAG => 15 - ); - $loc_parts_arr11 = array( - Locale::LANG_TAG =>'de' , - Locale::REGION_TAG =>'DE', - 'private0' => 13, - 'variant1' => array(), - 'extlang2' => false - ); + $loc_parts_arr1 = array( + Locale::LANG_TAG =>'sl' , + Locale::SCRIPT_TAG =>'Latn' , + Locale::REGION_TAG =>'IT' + ); + $loc_parts_arr2 = array( + Locale::LANG_TAG =>'de' , + Locale::REGION_TAG =>'DE' + ); + $loc_parts_arr3 = array( + Locale::LANG_TAG =>'hi' + ); + $loc_parts_arr4 = array( + Locale::LANG_TAG =>'zh' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN' + ); + $loc_parts_arr5 = array( + Locale::LANG_TAG =>'es' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN' + ); + $loc_parts_arr6 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + Locale::VARIANT_TAG.'14' =>'rozaj' , + 'variant1'=>'nedis' + ); + $loc_parts_arr7 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + 'variant14'=>'rozaj' , + 'variant1'=>'nedis' , + 'extlang0'=>'lng' , + 'extlang1'=>'ing' + ); + $loc_parts_arr8 = array( + Locale::LANG_TAG =>'en' , + Locale::SCRIPT_TAG =>'Hans' , + Locale::REGION_TAG =>'CN', + 'variant14'=>'rozaj' , + 'variant1'=>'nedis' , + 'extlang0'=>'lng' , + 'extlang1'=>'ing', + 'private7'=>'prv1' , + 'private9'=>'prv2' + ); + $loc_parts_arr9 = array( + Locale::REGION_TAG =>'DE' + ); + $loc_parts_arr10 = array( + Locale::LANG_TAG => 45, + Locale::REGION_TAG => false, + Locale::SCRIPT_TAG => 15 + ); + $loc_parts_arr11 = array( + Locale::LANG_TAG =>'de' , + Locale::REGION_TAG =>'DE', + 'private0' => 13, + 'variant1' => array(), + 'extlang2' => false + ); $loc_parts_arr12 = array( Locale::LANG_TAG =>'en' , Locale::SCRIPT_TAG =>'Hans' , Locale::REGION_TAG =>'CN', Locale::VARIANT_TAG => array('nedis', 'rozaj'), - Locale::PRIVATE_TAG => array('prv1', 'prv2'), - Locale::EXTLANG_TAG => array('lng', 'ing') + Locale::PRIVATE_TAG => array('prv1', 'prv2'), + Locale::EXTLANG_TAG => array('lng', 'ing') ); - $loc_parts_arr = array( - 'loc1' => $loc_parts_arr1 , - 'loc2' => $loc_parts_arr2 , - 'loc3' => $loc_parts_arr3 , - 'loc4' => $loc_parts_arr4 , - 'loc5' => $loc_parts_arr5 , - 'loc6' => $loc_parts_arr6 , - 'loc7' => $loc_parts_arr7 , - 'loc8' => $loc_parts_arr8 , - 'loc9' => $loc_parts_arr9 , - 'loc10' => $loc_parts_arr10 , - 'loc11' => $loc_parts_arr11 , - 'loc12' => $loc_parts_arr12 - ); + $loc_parts_arr = array( + 'loc1' => $loc_parts_arr1 , + 'loc2' => $loc_parts_arr2 , + 'loc3' => $loc_parts_arr3 , + 'loc4' => $loc_parts_arr4 , + 'loc5' => $loc_parts_arr5 , + 'loc6' => $loc_parts_arr6 , + 'loc7' => $loc_parts_arr7 , + 'loc8' => $loc_parts_arr8 , + 'loc9' => $loc_parts_arr9 , + 'loc10' => $loc_parts_arr10 , + 'loc11' => $loc_parts_arr11 , + 'loc12' => $loc_parts_arr12 + ); error_reporting( E_ERROR ); $cnt = 0; $res_str = ''; - foreach($loc_parts_arr as $key => $value ){ - $res_str .= "\n------------"; - $res_str .= "\nInput Array name is : loc".(++$cnt) ; + foreach($loc_parts_arr as $key => $value ){ + $res_str .= "\n------------"; + $res_str .= "\nInput Array name is : loc".(++$cnt) ; /* - foreach($value as $valKey => $valValue ){ - $res_str .= $valKey ."->".$valValue." " ; - } + foreach($value as $valKey => $valValue ){ + $res_str .= $valKey ."->".$valValue." " ; + } */ - $locale = ut_loc_locale_compose( $value); - $res_str .= "\n\nComposed Locale: "; - if( $locale){ - $res_str .= "$locale"; - }else{ - $res_str .= "No values found from Locale compose due to the following error:\n"; - $res_str .= intl_get_error_message() ; - } - } - - $res_str .= "\n------------"; - $res_str .= "\n"; + $locale = ut_loc_locale_compose( $value); + $res_str .= "\n\nComposed Locale: "; + if( $locale){ + $res_str .= "$locale"; + }else{ + $res_str .= "No values found from Locale compose due to the following error:\n"; + $res_str .= intl_get_error_message() ; + } + } + + $res_str .= "\n------------"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_filter_matches2.phpt b/ext/intl/tests/locale_filter_matches2.phpt index e75079deb3..82e16dafce 100644 --- a/ext/intl/tests/locale_filter_matches2.phpt +++ b/ext/intl/tests/locale_filter_matches2.phpt @@ -13,60 +13,60 @@ locale_filter_matches.phpt() icu >= 4.8 && icu < 50.1.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban', - 'sl_IT' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban', + 'sl_IT' + ); - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT' - ); + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ - foreach($lang_tags as $lang_tag){ - $res_str .="--------------\n"; - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); - $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } + foreach($loc_ranges as $loc_range){ + foreach($lang_tags as $lang_tag){ + $res_str .="--------------\n"; + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); + $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } //canonicalized version - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); - $can_loc_range = ut_loc_canonicalize($loc_range); - $can_lang_tag = ut_loc_canonicalize($lang_tag); - $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } - } - } + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); + $can_loc_range = ut_loc_canonicalize($loc_range); + $can_lang_tag = ut_loc_canonicalize($lang_tag); + $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } + } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_filter_matches3.phpt b/ext/intl/tests/locale_filter_matches3.phpt index 2816ba5e12..703ba78154 100644 --- a/ext/intl/tests/locale_filter_matches3.phpt +++ b/ext/intl/tests/locale_filter_matches3.phpt @@ -13,60 +13,60 @@ locale_filter_matches.phpt() ICU >= 51.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban', - 'sl_IT' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban', + 'sl_IT' + ); - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT' - ); + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ - foreach($lang_tags as $lang_tag){ - $res_str .="--------------\n"; - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); - $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } + foreach($loc_ranges as $loc_range){ + foreach($lang_tags as $lang_tag){ + $res_str .="--------------\n"; + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical); + $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } //canonicalized version - $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); - $can_loc_range = ut_loc_canonicalize($loc_range); - $can_lang_tag = ut_loc_canonicalize($lang_tag); - $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; - if( $result){ - $res_str .= "YES\n"; - }else{ - $res_str .= "NO\n"; - } - } - } + $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical)); + $can_loc_range = ut_loc_canonicalize($loc_range); + $can_lang_tag = ut_loc_canonicalize($lang_tag); + $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? "; + if( $result){ + $res_str .= "YES\n"; + }else{ + $res_str .= "NO\n"; + } + } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt index 8f2bcbfa39..7807e2b09a 100644 --- a/ext/intl/tests/locale_get_all_variants.phpt +++ b/ext/intl/tests/locale_get_all_variants.phpt @@ -12,34 +12,34 @@ locale_get_all_variants.phpt() function ut_main() { - $locales = array( - 'sl_IT_nedis_KIRTI', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'zh-hakka', - 'zh-wuu', - 'i-tay', - 'sgn-BE-nl', - 'sgn-CH-de', - 'sl_IT_rozaj@currency=EUR' - ); + $locales = array( + 'sl_IT_nedis_KIRTI', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'zh-hakka', + 'zh-wuu', + 'i-tay', + 'sgn-BE-nl', + 'sgn-CH-de', + 'sl_IT_rozaj@currency=EUR' + ); $res_str = ''; - foreach($locales as $locale){ - $variants_arr = ut_loc_locale_get_all_variants( $locale); - $res_str .= "$locale : variants "; - if( $variants_arr){ - foreach($variants_arr as $variant){ - $res_str .= "'$variant',"; - } - }else{ - $res_str .= "--none"; - } - $res_str .= "\n"; - } + foreach($locales as $locale){ + $variants_arr = ut_loc_locale_get_all_variants( $locale); + $res_str .= "$locale : variants "; + if( $variants_arr){ + foreach($variants_arr as $variant){ + $res_str .= "'$variant',"; + } + }else{ + $res_str .= "--none"; + } + $res_str .= "\n"; + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt index 2df91ba71d..e441b2efc6 100644 --- a/ext/intl/tests/locale_get_display_language.phpt +++ b/ext/intl/tests/locale_get_display_language.phpt @@ -14,7 +14,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'uk-ua_CALIFORNIA@currency=;currency=GRN', @@ -72,15 +72,15 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_language( $locale ,$disp_locale ); - $res_str .= "disp_locale=$disp_locale : display_language=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_language( $locale ,$disp_locale ); + $res_str .= "disp_locale=$disp_locale : display_language=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name2.phpt b/ext/intl/tests/locale_get_display_name2.phpt index 313e89b3c0..1d16dd023b 100644 --- a/ext/intl/tests/locale_get_display_name2.phpt +++ b/ext/intl/tests/locale_get_display_name2.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name3.phpt b/ext/intl/tests/locale_get_display_name3.phpt index 2052a6d456..d0c2307288 100644 --- a/ext/intl/tests/locale_get_display_name3.phpt +++ b/ext/intl/tests/locale_get_display_name3.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name4.phpt b/ext/intl/tests/locale_get_display_name4.phpt index a0b40a4114..e431b25151 100644 --- a/ext/intl/tests/locale_get_display_name4.phpt +++ b/ext/intl/tests/locale_get_display_name4.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name5.phpt b/ext/intl/tests/locale_get_display_name5.phpt index ac64fee021..9f4e1b645c 100644 --- a/ext/intl/tests/locale_get_display_name5.phpt +++ b/ext/intl/tests/locale_get_display_name5.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name6.phpt b/ext/intl/tests/locale_get_display_name6.phpt index 9d0542c3d4..a00464e73e 100644 --- a/ext/intl/tests/locale_get_display_name6.phpt +++ b/ext/intl/tests/locale_get_display_name6.phpt @@ -16,7 +16,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -84,16 +84,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_display_name7.phpt b/ext/intl/tests/locale_get_display_name7.phpt index 91e2c92e87..8ef0c09241 100644 --- a/ext/intl/tests/locale_get_display_name7.phpt +++ b/ext/intl/tests/locale_get_display_name7.phpt @@ -15,7 +15,7 @@ function ut_main() { $res_str=''; - $disp_locales=array('en','fr','de'); + $disp_locales=array('en','fr','de'); $locales = array( 'sl_IT_nedis_KIRTI', @@ -83,16 +83,16 @@ function ut_main() $res_str = ''; - foreach( $locales as $locale ) + foreach( $locales as $locale ) { - $res_str .= "locale='$locale'\n"; - foreach( $disp_locales as $disp_locale ) - { - $scr = ut_loc_get_display_name( $locale ,$disp_locale ); - $scr = str_replace(array('(', ')'), '#', $scr); - $res_str .= "disp_locale=$disp_locale : display_name=$scr"; - $res_str .= "\n"; - } + $res_str .= "locale='$locale'\n"; + foreach( $disp_locales as $disp_locale ) + { + $scr = ut_loc_get_display_name( $locale ,$disp_locale ); + $scr = str_replace(array('(', ')'), '#', $scr); + $res_str .= "disp_locale=$disp_locale : display_name=$scr"; + $res_str .= "\n"; + } $res_str .= "-----------------\n"; } diff --git a/ext/intl/tests/locale_get_keywords2.phpt b/ext/intl/tests/locale_get_keywords2.phpt index 23a099b4ed..8d6f3d113b 100644 --- a/ext/intl/tests/locale_get_keywords2.phpt +++ b/ext/intl/tests/locale_get_keywords2.phpt @@ -15,12 +15,12 @@ function ut_main() $res_str = ''; $locales = array( - "de_DE@currency=EUR;collation=PHONEBOOK", + "de_DE@currency=EUR;collation=PHONEBOOK", 'uk-ua_CALIFORNIA@currency=GRN' - ); + ); $locales = array( - 'de_DE@currency=EUR;collation=PHONEBOOK', + 'de_DE@currency=EUR;collation=PHONEBOOK', 'root', 'uk@currency=EURO', 'Hindi', @@ -77,14 +77,14 @@ function ut_main() { $keywords_arr = ut_loc_get_keywords( $locale); $res_str .= "$locale: "; - if( $keywords_arr){ - foreach( $keywords_arr as $key => $value){ - $res_str .= "Key is $key and Value is $value \n"; - } - } - else{ - $res_str .= "No keywords found."; - } + if( $keywords_arr){ + foreach( $keywords_arr as $key => $value){ + $res_str .= "Key is $key and Value is $value \n"; + } + } + else{ + $res_str .= "No keywords found."; + } $res_str .= "\n"; } diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt index 65ec3d89bc..69201e8de2 100644 --- a/ext/intl/tests/locale_get_primary_language.phpt +++ b/ext/intl/tests/locale_get_primary_language.phpt @@ -16,14 +16,14 @@ function ut_main() $locales = array( 'uk-ua_CALIFORNIA@currency=;currency=GRN', - 'root', + 'root', 'uk@currency=EURO', 'Hindi', //Simple language subtag 'de', 'fr', 'ja', - 'i-enochian', //(example of a grandfathered tag) + 'i-enochian', //(example of a grandfathered tag) //Language subtag plus Script subtag: 'zh-Hant', 'zh-Hans', diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt index 9d4843038d..da67b390fa 100644 --- a/ext/intl/tests/locale_lookup.phpt +++ b/ext/intl/tests/locale_lookup.phpt @@ -13,39 +13,39 @@ locale_lookup.phpt() icu >= 4.8 && icu < 50.1.2 function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban' - ); - - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT', - 'zh-Hant-CN-x-prv1-prv2' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban' + ); + + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT', + 'zh-Hant-CN-x-prv1-prv2' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ + foreach($loc_ranges as $loc_range){ $res_str .="--------------\n"; $result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US"); $comma_arr =implode(",",$lang_tags); @@ -56,9 +56,9 @@ function ut_main() $can_loc_range = ut_loc_canonicalize($loc_range); $res_str .= "Canonical lookup result:$result\n"; - } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_lookup_variant2.phpt b/ext/intl/tests/locale_lookup_variant2.phpt index 75a5350abf..7375284a0b 100644 --- a/ext/intl/tests/locale_lookup_variant2.phpt +++ b/ext/intl/tests/locale_lookup_variant2.phpt @@ -13,39 +13,39 @@ locale_lookup.phpt() function ut_main() { - $loc_ranges = array( - 'de-de', - 'sl_IT', - 'sl_IT_Nedis', - 'jbo', - 'art-lojban' - ); - - $lang_tags = array( - 'de-DEVA', - 'de-DE-1996', - 'de-DE', - 'zh_Hans', - 'de-CH-1996', - 'sl_IT', - 'sl_IT_nedis-a-kirti-x-xyz', - 'sl_IT_rozaj', - 'sl_IT_NEDIS_ROJAZ_1901', - 'i-enochian', - 'sgn-CH-de', - 'art-lojban', - 'i-lux', - 'art-lojban', - 'jbo', - 'en_sl_IT', - 'zh-Hant-CN-x-prv1-prv2' - ); + $loc_ranges = array( + 'de-de', + 'sl_IT', + 'sl_IT_Nedis', + 'jbo', + 'art-lojban' + ); + + $lang_tags = array( + 'de-DEVA', + 'de-DE-1996', + 'de-DE', + 'zh_Hans', + 'de-CH-1996', + 'sl_IT', + 'sl_IT_nedis-a-kirti-x-xyz', + 'sl_IT_rozaj', + 'sl_IT_NEDIS_ROJAZ_1901', + 'i-enochian', + 'sgn-CH-de', + 'art-lojban', + 'i-lux', + 'art-lojban', + 'jbo', + 'en_sl_IT', + 'zh-Hant-CN-x-prv1-prv2' + ); $res_str = ''; $isCanonical = false; - foreach($loc_ranges as $loc_range){ + foreach($loc_ranges as $loc_range){ $res_str .="--------------\n"; $result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US"); $comma_arr =implode(",",$lang_tags); @@ -56,9 +56,9 @@ function ut_main() $can_loc_range = ut_loc_canonicalize($loc_range); $res_str .= "Canonical lookup result:$result\n"; - } + } - $res_str .= "\n"; + $res_str .= "\n"; return $res_str; } diff --git a/ext/intl/tests/locale_parse_locale2.phpt b/ext/intl/tests/locale_parse_locale2.phpt index c823f8c504..59e0c1f678 100644 --- a/ext/intl/tests/locale_parse_locale2.phpt +++ b/ext/intl/tests/locale_parse_locale2.phpt @@ -63,7 +63,7 @@ function ut_main() 'de-419-DE', 'a-DE', 'ar-a-aaa-b-bbb-a-ccc', - 'x-AAAAAA', + 'x-AAAAAA', ); diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt index d56c9177cd..9f7438b98b 100644 --- a/ext/intl/tests/locale_set_default.phpt +++ b/ext/intl/tests/locale_set_default.phpt @@ -67,22 +67,22 @@ function ut_main() ); /* - $locales = array( - 'es' - ); + $locales = array( + 'es' + ); */ $res_str = ''; foreach( $locales as $locale ) { $isSuccessful = ut_loc_set_default( $locale); - if ($isSuccessful ){ - $lang = ut_loc_get_default( ); - $res_str .= "$locale: set locale '$lang'"; - } - else{ - $res_str .= "$locale: Error in set locale"; - } + if ($isSuccessful ){ + $lang = ut_loc_get_default( ); + $res_str .= "$locale: set locale '$lang'"; + } + else{ + $res_str .= "$locale: Error in set locale"; + } $res_str .= "\n"; } diff --git a/ext/intl/tests/msgfmt_bug70484.phpt b/ext/intl/tests/msgfmt_bug70484.phpt index f317be30db..660fc92f3b 100644 --- a/ext/intl/tests/msgfmt_bug70484.phpt +++ b/ext/intl/tests/msgfmt_bug70484.phpt @@ -12,25 +12,25 @@ $locale = array("de", "fr", "en", "ru",); $data = array(42, 42.42, 2147483643, 2147483643.12345, 5); foreach ($locale as $lc) { - echo "$lc string key\n"; - $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); - foreach ($data as $i) { - var_dump($m->format(array("n" => $i))); - if ($m->getErrorCode()) { - echo "$lc $i ", $m->getErrorMessage(); - } - } - echo "\n"; + echo "$lc string key\n"; + $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); + foreach ($data as $i) { + var_dump($m->format(array("n" => $i))); + if ($m->getErrorCode()) { + echo "$lc $i ", $m->getErrorMessage(); + } + } + echo "\n"; - echo "$lc numeric key\n"; - $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); - foreach ($data as $i) { - var_dump($m->format(array($i))); - if ($m->getErrorCode()) { - echo "$lc $i ", $m->getErrorMessage(); - } - } - echo "\n"; + echo "$lc numeric key\n"; + $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}"); + foreach ($data as $i) { + var_dump($m->format(array($i))); + if ($m->getErrorCode()) { + echo "$lc $i ", $m->getErrorMessage(); + } + } + echo "\n"; } ?> diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt index 69105a6b04..829cd6f1e2 100644 --- a/ext/intl/tests/msgfmt_clone_bad_obj.phpt +++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt @@ -6,14 +6,14 @@ Cloning unconstructed MessageFormatter <?php class A extends MessageFormatter { - function __construct() {} + function __construct() {} } $a = new A; try { - $b = clone $a; + $b = clone $a; } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } --EXPECTF-- string(%d) "Cannot clone unconstructed MessageFormatter" diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt index 688e65a861..060976d19e 100644 --- a/ext/intl/tests/msgfmt_fail2.phpt +++ b/ext/intl/tests/msgfmt_fail2.phpt @@ -6,104 +6,104 @@ msgfmt creation failures icu >= 4.8 <?php function err($fmt) { - if(!$fmt) { - echo var_export(intl_get_error_message(), true)."\n"; - } + if(!$fmt) { + echo var_export(intl_get_error_message(), true)."\n"; + } } function print_exception($e) { - echo "\n" . get_class($e) . ": " . $e->getMessage() + echo "\n" . get_class($e) . ": " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { - switch(true) { - case $t == "O": - try { - return new MessageFormatter($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "C": - try { - return MessageFormatter::create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - case $t == "P": - try { - return msgfmt_create($l, $s); - } catch (Throwable $e) { - print_exception($e); - return null; - } - break; - } + switch(true) { + case $t == "O": + try { + return new MessageFormatter($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "C": + try { + return MessageFormatter::create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + case $t == "P": + try { + return msgfmt_create($l, $s); + } catch (Throwable $e) { + print_exception($e); + return null; + } + break; + } } $args = array( - array(null, null), - array("whatever", "{0,whatever}"), - array(array(), array()), - array("en", "{0,choice}"), - array("fr", "{0,"), - array("en_US", "\xD0"), + array(null, null), + array("whatever", "{0,whatever}"), + array(array(), array()), + array("en", "{0,choice}"), + array("fr", "{0,"), + array("en_US", "\xD0"), ); try { - $fmt = new MessageFormatter(); + $fmt = new MessageFormatter(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = msgfmt_create(); + $fmt = msgfmt_create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = MessageFormatter::create(); + $fmt = MessageFormatter::create(); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = new MessageFormatter('en'); + $fmt = new MessageFormatter('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = msgfmt_create('en'); + $fmt = msgfmt_create('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); try { - $fmt = MessageFormatter::create('en'); + $fmt = MessageFormatter::create('en'); } catch (TypeError $e) { - print_exception($e); - $fmt = null; + print_exception($e); + $fmt = null; } err($fmt); foreach($args as $arg) { - $fmt = crt("O", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("C", $arg[0], $arg[1]); - err($fmt); - $fmt = crt("P", $arg[0], $arg[1]); - err($fmt); + $fmt = crt("O", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("C", $arg[0], $arg[1]); + err($fmt); + $fmt = crt("P", $arg[0], $arg[1]); + err($fmt); } ?> diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt index 19581e9698..55f7d65906 100644 --- a/ext/intl/tests/msgfmt_format.phpt +++ b/ext/intl/tests/msgfmt_format.phpt @@ -17,24 +17,24 @@ function ut_main() 'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi", 'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum", 'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree", - 'root' => '{0,whatever} would not work!', - 'fr' => "C'est la vie!", + 'root' => '{0,whatever} would not work!', + 'fr' => "C'est la vie!", ); $str_res = ''; - $m = 4560; - $t = 123; + $m = 4560; + $t = 123; foreach( $locales as $locale => $pattern ) { $str_res .= "\nLocale is: $locale\n"; $fmt = ut_msgfmt_create( $locale, $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - continue; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + continue; + } $str_res .= dump( ut_msgfmt_format( $fmt, array($m, $t, $m/$t) ) ) . "\n"; - $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n"; + $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n"; } return $str_res; } diff --git a/ext/intl/tests/msgfmt_format_intlcalendar.phpt b/ext/intl/tests/msgfmt_format_intlcalendar.phpt index 69f32e95f3..4867d767ed 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt index 105792bff5..d60ce8c566 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt index 505a2fdafd..9235a559f8 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt @@ -21,7 +21,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt index e10a51c7b8..c03254096a 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt @@ -20,7 +20,7 @@ echo $msgf->format(array($cal)), "\n"; '{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}'); echo "msgf2: ", $msgf->format(array($time, 'date')), " ", - $msgf->format(array($time, 'time')), "\n"; + $msgf->format(array($time, 'time')), "\n"; */ ?> diff --git a/ext/intl/tests/msgfmt_format_mixed_params.phpt b/ext/intl/tests/msgfmt_format_mixed_params.phpt index a9e403a799..f891e973c0 100644 --- a/ext/intl/tests/msgfmt_format_mixed_params.phpt +++ b/ext/intl/tests/msgfmt_format_mixed_params.phpt @@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', - "{0,number} -- {foo,ordinal}"); + "{0,number} -- {foo,ordinal}"); var_dump($mf->format(array(2.3, "foo" => 1.3))); var_dump($mf->format(array("foo" => 1.3, 0 => 2.3))); diff --git a/ext/intl/tests/msgfmt_format_subpatterns.phpt b/ext/intl/tests/msgfmt_format_subpatterns.phpt index c18bb4be88..50970f0b9e 100644 --- a/ext/intl/tests/msgfmt_format_subpatterns.phpt +++ b/ext/intl/tests/msgfmt_format_subpatterns.phpt @@ -45,10 +45,10 @@ $args = array( $str_res = ''; $fmt = ut_msgfmt_create( 'en_US', $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - return $str_res; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + return $str_res; + } foreach ($args as $arg) { $str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n"; $str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n"; diff --git a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt index 249f73ce2c..7b56ccb4cc 100644 --- a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt +++ b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt @@ -45,10 +45,10 @@ $args = array( $str_res = ''; $fmt = ut_msgfmt_create( 'en_US', $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - return $str_res; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + return $str_res; + } foreach ($args as $arg) { $str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n"; $str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n"; diff --git a/ext/intl/tests/msgfmt_millisecond_dates.phpt b/ext/intl/tests/msgfmt_millisecond_dates.phpt index 8fc2f04e84..2a5723f2e0 100644 --- a/ext/intl/tests/msgfmt_millisecond_dates.phpt +++ b/ext/intl/tests/msgfmt_millisecond_dates.phpt @@ -11,7 +11,7 @@ date_default_timezone_set('Europe/Lisbon'); //ignored for now, see bug #58756 $d = 1336308097.123; $mf = new MessageFormatter('en_US', - "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened"); + "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened"); var_dump($mf->format(array(1336310569.123))); diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt index 95645a63a0..962aa083fd 100644 --- a/ext/intl/tests/msgfmt_parse.phpt +++ b/ext/intl/tests/msgfmt_parse.phpt @@ -17,32 +17,32 @@ function ut_main() 'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi", 'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum", 'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree", - 'root' => '{0,whatever} would not work!', - 'fr' => 'C\'est {0,number,integer}', + 'root' => '{0,whatever} would not work!', + 'fr' => 'C\'est {0,number,integer}', ); - $results = array( - 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi", - 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum", - 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", - 'fr' => "C'est 42", + $results = array( + 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi", + 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum", + 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree", + 'fr' => "C'est 42", - ); + ); - $str_res = ''; + $str_res = ''; foreach( $locales as $locale => $pattern ) { $str_res .= "\nLocale is: $locale\n"; $fmt = ut_msgfmt_create( $locale, $pattern ); - if(!$fmt) { - $str_res .= dump(intl_get_error_message())."\n"; - continue; - } + if(!$fmt) { + $str_res .= dump(intl_get_error_message())."\n"; + continue; + } $str_res .= dump( ut_msgfmt_parse( $fmt, $results[$locale] ) ) . "\n"; - $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n"; + $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n"; } return $str_res; } diff --git a/ext/intl/tests/msgfmt_setPattern_cache.phpt b/ext/intl/tests/msgfmt_setPattern_cache.phpt index 7afbcbd93b..86fda51d41 100644 --- a/ext/intl/tests/msgfmt_setPattern_cache.phpt +++ b/ext/intl/tests/msgfmt_setPattern_cache.phpt @@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING); //ini_set("intl.default_locale", "nl"); $mf = new MessageFormatter('en_US', - "{0,number} -- {1,ordinal}"); + "{0,number} -- {1,ordinal}"); var_dump($mf->format(array(1.3, 1.3))); var_dump($mf->format(array(1.3, 1.3))); diff --git a/ext/intl/tests/normalizer_get_raw_decomposition.phpt b/ext/intl/tests/normalizer_get_raw_decomposition.phpt index 63caa7d472..590707280f 100644 --- a/ext/intl/tests/normalizer_get_raw_decomposition.phpt +++ b/ext/intl/tests/normalizer_get_raw_decomposition.phpt @@ -13,15 +13,15 @@ normalizer_get_raw_decomposition() function ut_main() { - $result = ''; - $strings = [ - "a", + $result = ''; + $strings = [ + "a", "\u{FFDA}", "\u{FDFA}", "", "aa", "\xF5", - ]; + ]; foreach ($strings as $string) { $decomposition = ut_norm_get_raw_decomposition($string, Normalizer::FORM_KC); @@ -39,7 +39,7 @@ function ut_main() $result .= "error info: '$error_message' ($error_code)\n"; } - return $result; + return $result; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt index 8f15ffb1d8..1a5050526e 100644 --- a/ext/intl/tests/normalizer_normalize.phpt +++ b/ext/intl/tests/normalizer_normalize.phpt @@ -12,81 +12,81 @@ normalize() function ut_main() { - $res_str = ''; - - $forms = array( - Normalizer::FORM_C, - Normalizer::FORM_D, - Normalizer::FORM_KC, - Normalizer::FORM_KD, - ); - - $forms_str = array ( - Normalizer::FORM_C => 'UNORM_FORM_C', - Normalizer::FORM_D => 'UNORM_FORM_D', - Normalizer::FORM_KC => 'UNORM_FORM_KC', - Normalizer::FORM_KD => 'UNORM_FORM_KD', - ); - - /* just make sure all the form constants are defined as in the api spec */ - if ( Normalizer::FORM_C != Normalizer::NFC || - Normalizer::FORM_D != Normalizer::NFD || - Normalizer::FORM_KC != Normalizer::NFKC || - Normalizer::FORM_KD != Normalizer::NFKD) { - - $res_str .= "Invalid normalization form declarations!\n"; - } - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - $strs = array( - 'ABC', - $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, - $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, - $char_ohm_sign . '||' . $char_omega, - $char_fi_ligature, - $char_long_s_dot, - ); - - foreach( $forms as $form ) - { - foreach( $strs as $str ) - { - $str_norm = ut_norm_normalize( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $str_hex = urlencode($str); - $str_norm_hex = urlencode($str_norm); - $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" - . "\terror info: '$error_message' ($error_code)\n" - . ""; - - $is_norm = ut_norm_is_normalized( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") - . "\terror info: '$error_message' ($error_code)\n" - . ""; - } - } - - return $res_str; + $res_str = ''; + + $forms = array( + Normalizer::FORM_C, + Normalizer::FORM_D, + Normalizer::FORM_KC, + Normalizer::FORM_KD, + ); + + $forms_str = array ( + Normalizer::FORM_C => 'UNORM_FORM_C', + Normalizer::FORM_D => 'UNORM_FORM_D', + Normalizer::FORM_KC => 'UNORM_FORM_KC', + Normalizer::FORM_KD => 'UNORM_FORM_KD', + ); + + /* just make sure all the form constants are defined as in the api spec */ + if ( Normalizer::FORM_C != Normalizer::NFC || + Normalizer::FORM_D != Normalizer::NFD || + Normalizer::FORM_KC != Normalizer::NFKC || + Normalizer::FORM_KD != Normalizer::NFKD) { + + $res_str .= "Invalid normalization form declarations!\n"; + } + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + $strs = array( + 'ABC', + $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, + $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, + $char_ohm_sign . '||' . $char_omega, + $char_fi_ligature, + $char_long_s_dot, + ); + + foreach( $forms as $form ) + { + foreach( $strs as $str ) + { + $str_norm = ut_norm_normalize( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $str_hex = urlencode($str); + $str_norm_hex = urlencode($str_norm); + $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" + . "\terror info: '$error_message' ($error_code)\n" + . ""; + + $is_norm = ut_norm_is_normalized( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") + . "\terror info: '$error_message' ($error_code)\n" + . ""; + } + } + + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/normalizer_normalize_kc_cf.phpt b/ext/intl/tests/normalizer_normalize_kc_cf.phpt index c7a46e617d..77e8a95eaa 100644 --- a/ext/intl/tests/normalizer_normalize_kc_cf.phpt +++ b/ext/intl/tests/normalizer_normalize_kc_cf.phpt @@ -13,72 +13,72 @@ normalize() NFKC_Casefold function ut_main() { - $res_str = ''; - - $forms = array( - Normalizer::FORM_KC_CF, - ); - - $forms_str = array ( - Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF', - ); - - /* just make sure all the form constants are defined as in the api spec */ - if (Normalizer::FORM_C != Normalizer::NFC) { - $res_str .= "Invalid normalization form declarations!\n"; - } - - $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) - $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) - $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) - - $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) - $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) - - $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) - $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) - - $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) - - $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) - - $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) - - $strs = array( - 'ABC', - 'abc', - $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, - $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, - $char_ohm_sign . '||' . $char_omega, - $char_fi_ligature, - $char_long_s_dot, - ); - - foreach( $forms as $form ) - { - foreach( $strs as $str ) - { - $str_norm = ut_norm_normalize( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $str_hex = urlencode($str); - $str_norm_hex = urlencode($str_norm); - $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" - . "\terror info: '$error_message' ($error_code)\n" - . ""; - - $is_norm = ut_norm_is_normalized( $str, $form ); - $error_code = intl_get_error_code(); - $error_message = intl_get_error_message(); - - $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") - . "\terror info: '$error_message' ($error_code)\n" - . ""; - } - } - - return $res_str; + $res_str = ''; + + $forms = array( + Normalizer::FORM_KC_CF, + ); + + $forms_str = array ( + Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF', + ); + + /* just make sure all the form constants are defined as in the api spec */ + if (Normalizer::FORM_C != Normalizer::NFC) { + $res_str .= "Invalid normalization form declarations!\n"; + } + + $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4) + $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) + $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) + + $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B) + $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5) + + $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126) + $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9) + + $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A) + + $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01) + + $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B) + + $strs = array( + 'ABC', + 'abc', + $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis, + $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above, + $char_ohm_sign . '||' . $char_omega, + $char_fi_ligature, + $char_long_s_dot, + ); + + foreach( $forms as $form ) + { + foreach( $strs as $str ) + { + $str_norm = ut_norm_normalize( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $str_hex = urlencode($str); + $str_norm_hex = urlencode($str_norm); + $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'" + . "\terror info: '$error_message' ($error_code)\n" + . ""; + + $is_norm = ut_norm_is_normalized( $str, $form ); + $error_code = intl_get_error_code(); + $error_message = intl_get_error_message(); + + $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no") + . "\terror info: '$error_message' ($error_code)\n" + . ""; + } + } + + return $res_str; } include_once( 'ut_common.inc' ); diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt index 2281bb26e0..9f20806fa5 100644 --- a/ext/intl/tests/rbbiter___construct_basic.phpt +++ b/ext/intl/tests/rbbiter___construct_basic.phpt @@ -26,9 +26,9 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); var_dump(get_class($rbbi)); try { - $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu'); + $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu'); } catch (IntlException $e) { - var_dump(intl_get_error_code(), intl_get_error_message()); + var_dump(intl_get_error_code(), intl_get_error_message()); } ?> diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt index 8d689d5003..4592a62eb9 100644 --- a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt @@ -28,7 +28,7 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); $rbbi->setText('sdfkjsdf88á.... ,;'); do { - var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); + var_dump($rbbi->current(), $rbbi->getRuleStatusVec()); } while ($rbbi->next() != IntlBreakIterator::DONE); ?> diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt index 2cc71f4555..44da765292 100644 --- a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt +++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt @@ -26,8 +26,8 @@ $rbbi = new IntlRuleBasedBreakIterator($rules); $rbbi->setText('sdfkjsdf88á.... ,;'); do { - echo "pos : {$rbbi->current()}\n", - "rule status: {$rbbi->getRuleStatus()}\n"; + echo "pos : {$rbbi->current()}\n", + "rule status: {$rbbi->getRuleStatus()}\n"; } while ($rbbi->next() != IntlBreakIterator::DONE); ?> diff --git a/ext/intl/tests/resourcebundle.inc b/ext/intl/tests/resourcebundle.inc index a7727a3ec8..9eea8aaffb 100644 --- a/ext/intl/tests/resourcebundle.inc +++ b/ext/intl/tests/resourcebundle.inc @@ -2,11 +2,11 @@ define('BUNDLE', dirname(__FILE__)."/_files/resourcebundle"); function debug( $res ) { - if (is_null( $res )) { - $ret = "NULL\n"; - } - else { - $ret = print_r( $res, true ). "\n"; - } - return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() ); + if (is_null( $res )) { + $ret = "NULL\n"; + } + else { + $ret = print_r( $res, true ). "\n"; + } + return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() ); } diff --git a/ext/intl/tests/resourcebundle_arrayaccess.phpt b/ext/intl/tests/resourcebundle_arrayaccess.phpt index d035a8d304..8eaaff3af3 100644 --- a/ext/intl/tests/resourcebundle_arrayaccess.phpt +++ b/ext/intl/tests/resourcebundle_arrayaccess.phpt @@ -4,27 +4,27 @@ Test ResourceBundle array access and count - existing/missing keys <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - // fall back - $r = new ResourceBundle( 'en_US', BUNDLE ); + // fall back + $r = new ResourceBundle( 'en_US', BUNDLE ); - printf( "length: %d\n", count($r) ); - printf( "teststring: %s\n", $r['teststring'] ); - printf( "testint: %d\n", $r['testint'] ); + printf( "length: %d\n", count($r) ); + printf( "teststring: %s\n", $r['teststring'] ); + printf( "testint: %d\n", $r['testint'] ); - print_r( $r['testvector'] ); + print_r( $r['testvector'] ); - printf( "testbin: %s\n", bin2hex($r['testbin']) ); + printf( "testbin: %s\n", bin2hex($r['testbin']) ); - $r2 = $r['testtable']; - printf( "testtable: %d\n", $r2['major'] ); + $r2 = $r['testtable']; + printf( "testtable: %d\n", $r2['major'] ); - $r2 = $r['testarray']; - printf( "testarray: %s\n", $r2[2] ); + $r2 = $r['testarray']; + printf( "testarray: %s\n", $r2[2] ); - $t = $r['nonexisting']; - echo debug( $t ); + $t = $r['nonexisting']; + echo debug( $t ); ?> --EXPECT-- length: 6 diff --git a/ext/intl/tests/resourcebundle_countable.phpt b/ext/intl/tests/resourcebundle_countable.phpt index bacc18f10c..fb703160c9 100644 --- a/ext/intl/tests/resourcebundle_countable.phpt +++ b/ext/intl/tests/resourcebundle_countable.phpt @@ -4,11 +4,11 @@ Test ResourceBundle implements Countable <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - $r = new ResourceBundle( 'es', BUNDLE ); + $r = new ResourceBundle( 'es', BUNDLE ); - var_dump($r instanceof Countable); + var_dump($r instanceof Countable); ?> --EXPECT-- bool(true) diff --git a/ext/intl/tests/resourcebundle_create.phpt b/ext/intl/tests/resourcebundle_create.phpt index 09bad4fddf..d7ba99d523 100644 --- a/ext/intl/tests/resourcebundle_create.phpt +++ b/ext/intl/tests/resourcebundle_create.phpt @@ -8,35 +8,35 @@ Test ResourceBundle::__construct() - existing/missing bundles/locales include "resourcebundle.inc"; function ut_main() { - $str_res = ''; - // all fine - $r1 = ut_resourcebundle_create( 'root', BUNDLE ); - $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['teststring'], true)."\n"; - - // non-root one - $r1 = ut_resourcebundle_create( 'es', BUNDLE ); - $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['teststring'], true)."\n"; - - // fall back - $r1 = ut_resourcebundle_create( 'en_US', BUNDLE ); + $str_res = ''; + // all fine + $r1 = ut_resourcebundle_create( 'root', BUNDLE ); + $str_res .= debug( $r1 ); + $str_res .= print_r( $r1['teststring'], true)."\n"; + + // non-root one + $r1 = ut_resourcebundle_create( 'es', BUNDLE ); + $str_res .= debug( $r1 ); + $str_res .= print_r( $r1['teststring'], true)."\n"; + + // fall back + $r1 = ut_resourcebundle_create( 'en_US', BUNDLE ); $str_res .= debug( $r1 ); - $str_res .= print_r( $r1['testsring'], true); + $str_res .= print_r( $r1['testsring'], true); - // fall out - $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false ); + // fall out + $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false ); $str_res .= debug( $r2 ); - // missing - $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' ); + // missing + $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' ); $str_res .= debug( $r3 ); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- ResourceBundle Object diff --git a/ext/intl/tests/resourcebundle_individual.phpt b/ext/intl/tests/resourcebundle_individual.phpt index 0fb512f8e5..46ce239e4d 100644 --- a/ext/intl/tests/resourcebundle_individual.phpt +++ b/ext/intl/tests/resourcebundle_individual.phpt @@ -4,34 +4,34 @@ Test ResourceBundle::get() and length() - existing/missing keys <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; function ut_main() { - $str_res = ''; - // fall back - $r = ut_resourcebundle_create( 'en_US', BUNDLE ); + $str_res = ''; + // fall back + $r = ut_resourcebundle_create( 'en_US', BUNDLE ); - $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) ); - $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) ); - $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) ); + $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) ); + $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) ); + $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) ); - $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true ); + $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true ); - $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) ); + $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) ); - $r2 = ut_resourcebundle_get($r, 'testtable' ); - $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) ); + $r2 = ut_resourcebundle_get($r, 'testtable' ); + $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) ); - $r2 = ut_resourcebundle_get($r,'testarray' ); - $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) ); + $r2 = ut_resourcebundle_get($r,'testarray' ); + $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) ); - $t = ut_resourcebundle_get( $r, 'nonexisting' ); - $str_res .= debug( $t ); + $t = ut_resourcebundle_get( $r, 'nonexisting' ); + $str_res .= debug( $t ); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- length: 6 diff --git a/ext/intl/tests/resourcebundle_iterator.phpt b/ext/intl/tests/resourcebundle_iterator.phpt index e0b83d8190..93833fdf35 100644 --- a/ext/intl/tests/resourcebundle_iterator.phpt +++ b/ext/intl/tests/resourcebundle_iterator.phpt @@ -4,33 +4,33 @@ Test ResourceBundle iterator <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - // fall back - $r = new ResourceBundle( 'en_US', BUNDLE ); + // fall back + $r = new ResourceBundle( 'en_US', BUNDLE ); - foreach ($r as $onekey => $oneval) { - echo "Here comes $onekey:\n"; - switch (gettype($oneval)) { - case 'string': - echo bin2hex( $oneval ) . "\n"; - break; + foreach ($r as $onekey => $oneval) { + echo "Here comes $onekey:\n"; + switch (gettype($oneval)) { + case 'string': + echo bin2hex( $oneval ) . "\n"; + break; - case 'integer': - echo "$oneval\n"; - break; + case 'integer': + echo "$oneval\n"; + break; - default: - print_r( $oneval ); - } - echo "\n"; - } + default: + print_r( $oneval ); + } + echo "\n"; + } - echo "Testarray Contents:\n"; - $r = $r->get( 'testarray' ); - foreach ($r as $onekey => $oneval) { - echo "$onekey => $oneval\n"; - } + echo "Testarray Contents:\n"; + $r = $r->get( 'testarray' ); + foreach ($r as $onekey => $oneval) { + echo "$onekey => $oneval\n"; + } ?> --EXPECT-- Here comes testarray: diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt index c744e63193..16b863d4e8 100644 --- a/ext/intl/tests/resourcebundle_locales.phpt +++ b/ext/intl/tests/resourcebundle_locales.phpt @@ -8,15 +8,15 @@ Test ResourceBundle::getLocales include "resourcebundle.inc"; function ut_main() { - $str_res = ''; + $str_res = ''; - $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE)); + $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE)); - return $str_res; + return $str_res; } - include_once( 'ut_common.inc' ); - ut_run(); + include_once( 'ut_common.inc' ); + ut_run(); ?> --EXPECT-- es diff --git a/ext/intl/tests/resourcebundle_traversable.phpt b/ext/intl/tests/resourcebundle_traversable.phpt index 4aeec2330d..93d4c2a41e 100644 --- a/ext/intl/tests/resourcebundle_traversable.phpt +++ b/ext/intl/tests/resourcebundle_traversable.phpt @@ -4,12 +4,12 @@ Bug #55610: ResourceBundle does not implement Traversable <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> --FILE-- <?php - include "resourcebundle.inc"; + include "resourcebundle.inc"; - $r = new ResourceBundle( 'es', BUNDLE ); + $r = new ResourceBundle( 'es', BUNDLE ); - var_dump($r instanceof Traversable); - var_dump(iterator_to_array($r->get('testarray'))); + var_dump($r instanceof Traversable); + var_dump(iterator_to_array($r->get('testarray'))); ?> --EXPECT-- bool(true) diff --git a/ext/intl/tests/timezone_clone_error.phpt b/ext/intl/tests/timezone_clone_error.phpt index 4052776775..8df6a8ffe3 100644 --- a/ext/intl/tests/timezone_clone_error.phpt +++ b/ext/intl/tests/timezone_clone_error.phpt @@ -17,7 +17,7 @@ var_dump($tz); try { var_dump(clone $tz); } catch (Exception $e) { - var_dump(get_class($e), $e->getMessage()); + var_dump(get_class($e), $e->getMessage()); } ?> diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt index 348478e396..985957d3ca 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt @@ -8,15 +8,15 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - -3600000); + IntlTimeZone::TYPE_ANY, + 'PT', + -3600000); print_r(iterator_to_array($enum)); $enum = intltz_create_time_zone_id_enumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - -3600000); + IntlTimeZone::TYPE_ANY, + 'PT', + -3600000); print_r(iterator_to_array($enum)); ?> --EXPECT-- diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt index 37edd7e9c7..84711ff57f 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt @@ -8,16 +8,16 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT'); + IntlTimeZone::TYPE_ANY, + 'PT'); $values = iterator_to_array($enum); var_dump(in_array('Europe/Lisbon', $values)); var_dump(in_array('Atlantic/Azores', $values)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, - 'PT', - null); + IntlTimeZone::TYPE_ANY, + 'PT', + null); $values2 = iterator_to_array($enum); var_dump($values2 == $values); diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt index e7ae961a4a..4d37fe3e64 100644 --- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt +++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt @@ -8,25 +8,25 @@ if (!extension_loaded('intl')) <?php ini_set("intl.error_level", E_WARNING); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY); + IntlTimeZone::TYPE_ANY); $countAny = count(iterator_to_array($enum)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_CANONICAL); + IntlTimeZone::TYPE_CANONICAL); $countCanonical = count(iterator_to_array($enum)); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_CANONICAL_LOCATION); + IntlTimeZone::TYPE_CANONICAL_LOCATION); $countCanonicalLocation = count(iterator_to_array($enum)); var_dump($countAny > $countCanonical); var_dump($countCanonical > $countCanonicalLocation); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, null, null); + IntlTimeZone::TYPE_ANY, null, null); $countAny2 = count(iterator_to_array($enum)); var_dump($countAny == $countAny2); $enum = IntlTimeZone::createTimeZoneIDEnumeration( - IntlTimeZone::TYPE_ANY, null, -3600000); + IntlTimeZone::TYPE_ANY, null, -3600000); $values = iterator_to_array($enum); print_r( diff --git a/ext/intl/tests/timezone_equals_error.phpt b/ext/intl/tests/timezone_equals_error.phpt index d5eeedb2d9..3d489d14a6 100644 --- a/ext/intl/tests/timezone_equals_error.phpt +++ b/ext/intl/tests/timezone_equals_error.phpt @@ -18,7 +18,7 @@ var_dump($tz, $tz2); try { var_dump($tz == $tz2); } catch (Exception $e) { - var_dump(get_class($e), $e->getMessage()); + var_dump(get_class($e), $e->getMessage()); } ?> diff --git a/ext/intl/tests/timezone_getOffset_basic.phpt b/ext/intl/tests/timezone_getOffset_basic.phpt index 7efb1967ca..3dbf5b1ce4 100644 --- a/ext/intl/tests/timezone_getOffset_basic.phpt +++ b/ext/intl/tests/timezone_getOffset_basic.phpt @@ -14,12 +14,12 @@ $ams = IntlTimeZone::createTimeZone('Europe/Amsterdam'); $date = strtotime("1 July 2012 +0000"); var_dump($ams->getOffset($date *1000., true, $rawOffset, $dstOffset), - $rawOffset, $dstOffset); + $rawOffset, $dstOffset); $lsb = IntlTimeZone::createTimeZone('Europe/Lisbon'); var_dump(intltz_get_offset($lsb, $date *1000., true, $rawOffset, $dstOffset), - $rawOffset, $dstOffset); + $rawOffset, $dstOffset); ?> --EXPECT-- diff --git a/ext/intl/tests/timezone_hasSameRules_error.phpt b/ext/intl/tests/timezone_hasSameRules_error.phpt index 07aa15039c..e1cfb754ba 100644 --- a/ext/intl/tests/timezone_hasSameRules_error.phpt +++ b/ext/intl/tests/timezone_hasSameRules_error.phpt @@ -10,24 +10,24 @@ ini_set("intl.error_level", E_WARNING); function error_handler($errno, $errstr, $errfile, $errline) { - var_dump($errno, $errstr); - return true; + var_dump($errno, $errstr); + return true; } set_error_handler("error_handler"); $tz = IntlTimeZone::createTimeZone('Europe/Lisbon'); try { - var_dump($tz->hasSameRules('foo')); + var_dump($tz->hasSameRules('foo')); } catch (Error $ex) { - var_dump($ex->getCode(), $ex->getMessage()); - echo "\n"; + var_dump($ex->getCode(), $ex->getMessage()); + echo "\n"; } try { - var_dump(intltz_has_same_rules(null, $tz)); + var_dump(intltz_has_same_rules(null, $tz)); } catch (Error $ex) { - var_dump($ex->getCode(), $ex->getMessage()); - echo "\n"; + var_dump($ex->getCode(), $ex->getMessage()); + echo "\n"; } --EXPECT-- int(0) diff --git a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt index 831bc3df1a..3679fe9717 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt @@ -11,12 +11,12 @@ ini_set("intl.default_locale", "nl"); date_default_timezone_set('Europe/Lisbon'); function do_test(IntlTimeZone $tz, $proc = false) { - var_dump($tz->getID(), $tz->getRawOffset()); - if (!$proc) - $dtz = $tz->toDateTimeZone(); - else - $dtz = intltz_to_date_time_zone($tz); - var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); + var_dump($tz->getID(), $tz->getRawOffset()); + if (!$proc) + $dtz = $tz->toDateTimeZone(); + else + $dtz = intltz_to_date_time_zone($tz); + var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00'))); } do_test(IntlTimeZone::createTimeZone('CET')); diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt index 9df2bbf70d..119977b124 100644 --- a/ext/intl/tests/timezone_toDateTimeZone_error.phpt +++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt @@ -11,9 +11,9 @@ ini_set("intl.error_level", E_WARNING); $tz = IntlTimeZone::createTimeZone('Etc/Unknown'); try { - var_dump($tz->toDateTimeZone()); + var_dump($tz->toDateTimeZone()); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } var_dump(intltz_to_date_time_zone(1)); diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc index 6398b2876f..4a2675b01f 100644 --- a/ext/intl/tests/ut_common.inc +++ b/ext/intl/tests/ut_common.inc @@ -234,7 +234,7 @@ function ut_loc_get_default( ) } function ut_loc_set_default( $locale ) { - return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale ); + return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale ); } function ut_loc_get_primary_language( $locale ) { @@ -297,7 +297,7 @@ function ut_loc_locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_lo return $GLOBALS['oo-mode'] ? Locale::lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc ) : locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc ); } function ut_loc_accept_http($http) { - return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http); + return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http); } /* MessageFormatter functions */ function ut_msgfmt_create( $locale, $pattern) |