#35427 [Asn->Csd]: str_word_count() handles '-' incorrectly
| From: | iliaa@php.net | Date: | Tue, 29 Nov 2005 16:14:54 +0000 |
| Subject: | #35427 [Asn->Csd]: str_word_count() handles '-' incorrectly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-89401@lists.php.net to get a copy of this message | ||
ID: 35427
Updated by: iliaa@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Strings related
Operating System: *
PHP Version: 5.1.0
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-11-29 09:45:35] tomas_matousek at hotmail dot com
One more correction:
while (isalpha(*p) || *p == '\'' || (*p == '-' && (isalpha(*(p+1))
||
char_list && ch[(unsigned char)*(p+1)]))
|| (char_list && ch[(unsigned char)*p]))
------------------------------------------------------------------------
[2005-11-29 09:41:04] tomas_matousek at hotmail dot com
File string.c, line 4744:
while (isalpha(*p) || *p == '\'' || (*p == '-' && isalpha(*(p+1)))
||
(char_list && ch[(unsigned char)*p]))
should be:
while (isalpha(*p) || *p == '\'' || (*p == '-' && (isalpha(*(p+1)
||
(char_list && ch[(unsigned char)*p])))) || (char_list && ch[(unsigned
char)*p]))
------------------------------------------------------------------------
[2005-11-28 21:27:28] tomas_matousek at hotmail dot com
No, I needn't. str_word_count("bar-var") returns 1, so '-' is
considered as a part of the word if it is followed by 'word'
character.
See the source code. The bug is clear there.
------------------------------------------------------------------------
[2005-11-27 20:00:54] tomas_matousek at hotmail dot com
By passing "0" as the third parameter, one declares '0' character legal
word character which should be equivalent to any other letter, e.g. 'x'.
"bar-xbar" is considered to be a word so "bar-0bar" should be word as
well.
------------------------------------------------------------------------
[2005-11-27 19:28:44] tony2001@php.net
"bar-0var" doesn't look like a valid *WORD* to me.
Or is it?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35427
--
Edit this bug report at http://bugs.php.net/?id=35427&edit=1