moriyoshi Sun Dec 7 16:55:17 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/standard file.c
Log:
Those casts are really necessary.
# Heads up; please be careful using is*() functions. The function of that kind
# takes an integer value as its argument and expects the value to be range of
# 0-255 as a parameter. So if you pass a plain char value to it, the char
# value will be converted implicitly to an integer value of the range
# -128 ~ 127, which will end up with an unwanted result, most likely with
# non-ASCII characters. This has been considered to be a big flaw in the
# specification of the ctype functions. However, the malfunction is not
# reproducible with the recent versions of the GNU C library because it is
# made to deal with such exceptional cases, while Microsoft's C library
# and several standard C libraries of BSD origin aren't.
#
# See also bug #10896, #12127, #18318, and #21689.
#
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.42 php-src/ext/standard/file.c:1.279.2.43
--- php-src/ext/standard/file.c:1.279.2.42 Sat Dec 6 17:07:00 2003
+++ php-src/ext/standard/file.c Sun Dec 7 16:55:16 2003
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.279.2.42 2003/12/06 22:07:00 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.43 2003/12/07 21:55:16 moriyoshi Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -2257,11 +2257,11 @@
re = e = buf + buf_len;
/* strip leading spaces */
- while (isspace(*s) && *s != delimiter) {
+ while (isspace((int)*(unsigned char *)s) && *s != delimiter) {
s++;
}
/* strip trailing spaces */
- while (isspace(*(--e)) && *e != delimiter);
+ while (isspace((int)*(unsigned char *)(--e)) && *e != delimiter);
e++;
array_init(return_value);
@@ -2305,7 +2305,7 @@
s = p = buf;
re = e = buf + buf_len;
/* strip trailing spaces */
- while (isspace(*(--e)) && *e != delimiter);
+ while (isspace((int)*(unsigned char *)(--e)) && *e !=
delimiter);
e++;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php