|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-16 08:36 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
Description: ------------ str_word_count return wrong number, if char "я" is contained in the word. Problem code (in file ext/standard/string.c): while (p < e && (isalpha(*p) || (char_list && ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) { Corrected code: while (p < e && (isalpha((unsigned char)*p) || (char_list && ch[(unsigned char)*p]) || *p == '\'' || *p == '-')) { Description of bug fixes in Russian language: http://phpclub.ru/talk/showthread.php?postid=746475#post746475 Reproduce code: --------------- <?php setlocale(LC_ALL, 'ru_RU.cp-1251', 'ru_RU.CP1251'); var_dump(str_word_count('русский текст. я тестер. аябаг. яап. авя', 2)); ?> Expected result: ---------------- array(7) { [0]=> string(7) "русский" [8]=> string(5) "текст" [15]=> string(1) "я" [17]=> string(6) "тестер" [25]=> string(5) "аябаг" [32]=> string(3) "яап" [37]=> string(3) "авя" } Actual result: -------------- array(7) { [0]=> string(7) "русский" [8]=> string(5) "текст" [17]=> string(6) "тестер" [25]=> string(1) "а" [27]=> string(3) "баг" [33]=> string(2) "ап" [37]=> string(2) "ав" }