stasFri Apr 10 16:53:35 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/intl/grapheme grapheme_string.c
/php-src/ext/intl/tests grapheme.phpt
Log:
merge grapheme substr fix
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/grapheme/grapheme_string.c?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/intl/grapheme/grapheme_string.c
diff -u php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.2
php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.3
--- php-src/ext/intl/grapheme/grapheme_string.c:1.1.2.2 Mon Aug 11 19:48:00 2008
+++ php-src/ext/intl/grapheme/grapheme_string.c Fri Apr 10 16:53:35 2009
@@ -542,7 +542,7 @@
length += iter_val;
}
- if ( UBRK_DONE == sub_str_end_pos ) {
+ if ( UBRK_DONE == sub_str_end_pos && length < 0) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
"grapheme_substr: length not contained in string", 1 TSRMLS_CC );
http://cvs.php.net/viewvc.cgi/php-src/ext/intl/tests/grapheme.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/intl/tests/grapheme.phpt
diff -u php-src/ext/intl/tests/grapheme.phpt:1.1.2.1
php-src/ext/intl/tests/grapheme.phpt:1.1.2.2
--- php-src/ext/intl/tests/grapheme.phpt:1.1.2.1Mon Jul 7 22:51:04 2008
+++ php-src/ext/intl/tests/grapheme.phptFri Apr 10 16:53:35 2009
@@ -334,7 +334,9 @@
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" ),
@@ -953,6 +955,8 @@
substring of "abc" from "0" - grapheme_substr with length 2 = ab == ab
substring of "Abc" from "-4" - grapheme_substr with length 1 = false == false
substring of "ababc" from "1" - grapheme_substr with length 2 = ba == ba
+substring of "ababc" from "0" - grapheme_substr with length 10 = ababc == ababc
+substring of "aa%CC%8Abco%CC%88Opq" from "0" - grapheme_substr with length 10
= aa%CC%8Abco%CC%88Opq == aa%CC%8Abco%CC%88Opq
substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr = Opq == Opq
substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -1
= Op == Op
substring of "aa%CC%8Abco%CC%88Opq" from "5" - grapheme_substr with length -2
= O == O
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php