summaryrefslogtreecommitdiff
path: root/ext/standard/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r--ext/standard/string.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c
index e5164d5bfb..d48de12172 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4739,8 +4739,8 @@ PHP_FUNCTION(str_word_count)
}
while (p < e) {
- if (isalpha(*p++)) {
- s = p - 1;
+ if (isalpha(*p) || (char_list && ch[(unsigned char)*p])) {
+ s = ++p - 1;
while (isalpha(*p) || *p == '\'' || (*p == '-' && isalpha(*(p+1))) || (char_list && ch[(unsigned char)*p])) {
p++;
}
@@ -4761,7 +4761,9 @@ PHP_FUNCTION(str_word_count)
word_count++;
break;
}
- }
+ } else {
+ p++;
+ }
}
if (!type) {