mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
- MFH: Fixed bug #48709 (metaphone and 'wh')
This commit is contained in:
parent
51f8b64752
commit
0e294f2121
@ -225,15 +225,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;
|
||||
}
|
||||
|
31
ext/standard/tests/strings/bug48709.phpt
Normal file
31
ext/standard/tests/strings/bug48709.phpt
Normal file
@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Bug #48709 (metaphone and 'wh')
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
/* Initial letter exceptions */
|
||||
$exceptions = array(
|
||||
'kn', // Drop first letter
|
||||
'gn', // ditto
|
||||
'pn', // ditto
|
||||
'ae', // ditto
|
||||
'wr', // ditto
|
||||
'x', // s
|
||||
'wh', // w
|
||||
'wa' // w
|
||||
);
|
||||
|
||||
foreach ($exceptions as $letter) {
|
||||
printf("%s => %s\n", $letter, metaphone($letter));
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
kn => N
|
||||
gn => N
|
||||
pn => N
|
||||
ae => E
|
||||
wr => R
|
||||
x => S
|
||||
wh => W
|
||||
wa => W
|
Loading…
Reference in New Issue
Block a user