cvs: php-src /ext/standard string.c
| From: | Andrei Zmievski | Date: | Tue, 18 Apr 2006 05:18:12 +0000 |
| Subject: | cvs: php-src /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-37839@lists.php.net to get a copy of this message | ||
andrei Tue Apr 18 05:18:12 2006 UTC
Modified files:
/php-src/ext/standard string.c
Log:
I'm not sure what the heck people were thinking here, but it should be
fixed finally. Please test.
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.539&r2=1.540&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.539 php-src/ext/standard/string.c:1.540
--- php-src/ext/standard/string.c:1.539 Tue Apr 18 02:40:29 2006
+++ php-src/ext/standard/string.c Tue Apr 18 05:18:12 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.539 2006/04/18 02:40:29 andrei Exp $ */
+/* $Id: string.c,v 1.540 2006/04/18 05:18:12 andrei Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -721,10 +721,12 @@
}
if ( wh != ch ) break;
} else {
- if ( u_isWhitespace(ch) == FALSE ) break;
+ if ( u_isWhitespace(ch) == FALSE ) {
+ U16_BACK_1(c, 0, i); /* U16_NEXT() post-increments 'i' */
+ break;
+ }
}
}
- U16_BACK_1(c, 0, i); /* U16_NEXT() post-increments 'i' */
start = i;
}
if ( mode & 2 ) {
@@ -737,12 +739,13 @@
}
if ( wh != ch ) break;
} else {
- if ( u_isWhitespace(ch) == FALSE ) break;
+ if ( u_isWhitespace(ch) == FALSE ) {
+ U16_FWD_1(c, i, end); /* U16_PREV() pre-decrements 'i' */
+ break;
+ }
}
}
end = i;
- } else {
- --end;
}
if ( what )
{
@@ -751,10 +754,10 @@
if ( start < len ) {
if ( return_value ) {
- RETVAL_UNICODEL(c+start, end-start+1, 1);
+ RETVAL_UNICODEL(c+start, end-start, 1);
return NULL;
} else {
- return eustrndup(c+start, end-start+1);
+ return eustrndup(c+start, end-start);
}
} else { /* Trimmed the whole string */
if ( return_value ) {