From: Felipe Pena Date: Sun, 28 Jun 2009 18:41:20 +0000 (+0000) Subject: - Fixed bug #48709 (metaphone and 'wh') X-Git-Tag: php-5.4.0alpha1~191^2~3219 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6abff59291c1fe7115ff49ff6c73495720630cb6;p=php - Fixed bug #48709 (metaphone and 'wh') --- diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index 2d1c7bf083..675879de08 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -224,15 +224,14 @@ static int metaphone(unsigned char *word, int word_len, long max_phonemes, char w_idx += 2; } break; - /* WH becomes H, + /* WH becomes W, WR becomes R W if followed by a vowel */ case 'W': - if (Next_Letter == 'H' || - Next_Letter == 'R') { + if (Next_Letter == 'R') { Phonize(Next_Letter); w_idx += 2; - } else if (isvowel(Next_Letter)) { + } else if (Next_Letter == 'H' || isvowel(Next_Letter)) { Phonize('W'); w_idx += 2; } diff --git a/ext/standard/tests/strings/bug48709.phpt b/ext/standard/tests/strings/bug48709.phpt new file mode 100644 index 0000000000..999a2c6513 --- /dev/null +++ b/ext/standard/tests/strings/bug48709.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #48709 (metaphone and 'wh') +--FILE-- + %s\n", $letter, metaphone($letter)); +} + +?> +--EXPECT-- +kn => N +gn => N +pn => N +ae => E +wr => R +x => S +wh => W +wa => W