From: brettz9 at yahoo dot com Operating system: Windows PHP version: 6CVS-2009-06-28 (snap) PHP Bug Type: Unknown/Other Function Bug description: metaphone and 'wh'
Description: ------------ The source for metaphone() states in the comments that "WH becomes H" and when one tests it, e.g., with "whit", as per the comment on line 227 and the code which phonizes Next_Letter on line 233 when there is a 'W' followed by 'H', it returns 'H' ("ht" for 'whit'). However, according to the metaphone() algorithm (see http://aspell.net/metaphone/ and the original implementation at http://aspell.net/metaphone/metaphone.basic ), 'wh' should become 'w', not 'h'. So, to fix it, you could change the comment on 233 to: /* WH becomes W, and then change the 'if' on 231-234 to: if (Next_Letter == 'H') { Phonize('W'); w_idx += 2; } else if (Next_Letter == 'R') { Phonize(Next_Letter); w_idx += 2; Reproduce code: --------------- <?php echo metaphone('Whit'); ?> Expected result: ---------------- WT Actual result: -------------- HT -- Edit bug report at http://bugs.php.net/?id=48709&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48709&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48709&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48709&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48709&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48709&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48709&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48709&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48709&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48709&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48709&r=support Expected behavior: http://bugs.php.net/fix.php?id=48709&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48709&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48709&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48709&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48709&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48709&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48709&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48709&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48709&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48709&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48709&r=mysqlcfg