andrei Mon Aug 14 22:00:46 2006 UTC
Modified files:
/php-src unicode-progress.txt
/php-src/ext/standard string.c
Log:
Unicode support for strcoll().
http://cvs.php.net/viewvc.cgi/php-src/unicode-progress.txt?r1=1.43&r2=1.44&diff_format=u
Index: php-src/unicode-progress.txt
diff -u php-src/unicode-progress.txt:1.43 php-src/unicode-progress.txt:1.44
--- php-src/unicode-progress.txt:1.43 Mon Aug 14 21:04:50 2006
+++ php-src/unicode-progress.txt Mon Aug 14 22:00:46 2006
@@ -43,8 +43,6 @@
Params API. Rest - no idea yet.
str_replace()
- Params API, IS_UNICODE upgrade
-
stri_replace()
Params API, IS_UNICODE upgrade. Case-folding should be handled
similar to stristr().
@@ -52,9 +50,6 @@
str_word_count()
Params API, IS_UNICODE support, using u_isalpha(), etc.
- strcoll()
- Params API, upgrade to use Collator if TT == IS_UNICODE, test
-
stristr()
This is the problematic one. There are a few approaches:
@@ -188,6 +183,7 @@
str_rot13()
str_shuffle()
str_split()
+ strcoll()
strcspn()
strip_tags()
stripcslashes()
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.578&r2=1.579&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.578 php-src/ext/standard/string.c:1.579
--- php-src/ext/standard/string.c:1.578 Mon Aug 14 21:04:50 2006
+++ php-src/ext/standard/string.c Mon Aug 14 22:00:46 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.578 2006/08/14 21:04:50 andrei Exp $ */
+/* $Id: string.c,v 1.579 2006/08/14 22:00:46 andrei Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -494,24 +494,32 @@
#endif
/* }}} */
-#ifdef HAVE_STRCOLL
-/* {{{ proto int strcoll(string str1, string str2)
+/* {{{ proto int strcoll(string str1, string str2) U
Compares two strings using the current locale */
PHP_FUNCTION(strcoll)
{
- zval **s1, **s2;
+ zstr s1, s2;
+ int s1_len, s2_len;
+ zend_uchar str_type;
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) ==
FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len,
+ &str_type, &s2,
&s2_len, &str_type) == FAILURE) {
+ return;
+ }
+
+ if (str_type == IS_UNICODE) {
+
RETURN_LONG(ZEND_COLL_RESULT(ucol_strcoll(UG(default_collator)->coll, s1.u,
s1_len, s2.u, s2_len)));
+ } else {
+#ifdef HAVE_STRCOLL
+ RETURN_LONG(strcoll((const char *) s1.s,
+ (const char *) s2.s));
+#else
+ RETURN_FALSE;
+#endif
}
- convert_to_string_ex(s1);
- convert_to_string_ex(s2);
- RETURN_LONG(strcoll((const char *) Z_STRVAL_PP(s1),
- (const char *) Z_STRVAL_PP(s2)));
}
/* }}} */
-#endif
/* {{{ php_charmask
* Fills a 256-byte bytemask with input. You can specify a range like 'a..z',
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php