felipe Sun Jun 28 18:41:21 2009 UTC
Added files:
/php-src/ext/standard/tests/strings bug48709.phpt
Modified files:
/php-src/ext/standard metaphone.c
Log:
- Fixed bug #48709 (metaphone and 'wh')
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.41&r2=1.42&diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.41
php-src/ext/standard/metaphone.c:1.42
--- php-src/ext/standard/metaphone.c:1.41 Tue Mar 10 23:39:40 2009
+++ php-src/ext/standard/metaphone.c Sun Jun 28 18:41:20 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: metaphone.c,v 1.41 2009/03/10 23:39:40 helly Exp $ */
+/* $Id: metaphone.c,v 1.42 2009/06/28 18:41:20 felipe Exp $ */
/*
Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern
<[email protected]>
@@ -224,15 +224,14 @@
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;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug48709.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug48709.phpt
+++ php-src/ext/standard/tests/strings/bug48709.phpt
--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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php