From: brettz9 at yahoo dot com Operating system: Windows PHP version: 6CVS-2009-06-29 (snap) PHP Bug Type: Unknown/Other Function Bug description: metaphone and sch, ch, gh
Description: ------------ Below are a few bugs remaining in metaphone()--they are both useful and follow the original implementation. I haven't tested them (a newbie to C), but they seem to follow the precise pattern. 1) SCH: There seems to be no way for the 'traditional' argument in metaphone() to be triggered (it is called on line 44 with '1' which disables those items depending on it). Shouldn't it be set to '0' in the call on line 44 (or have the requirement removed entirely)? For example, line 314 is not working now for treating items like "ch" in "school" as "K". If there's no way to trigger the behavior (and the behavior should be standard), it seems to me best to remove the requirement. 2) CH: should check for first position 'C': if the next char is 'H' and then a vowel, it should produce 'K' To fix, in the switch beginning at 205 for initial character (e.g., could put before 219): case 'C': if (Next_Letter == 'H' && isvowel(After_Next_Letter)) { // 'character' Phonize('K'); w_idx += 2; } break; 3) GH: should be pronounced as 'K' if at the beginning (and if then followed by a vowel), not as 'F'; The case for initial 'G' on line 219 could be changed to: case 'G': if (Next_Letter == 'H' && isvowel(After_Next_Letter)) { // 'ghent' Phonize('K'); w_idx += 2; break; } else 4) GH: should be silent in the likes of 'knight'/'wright', not 'F' under the 2nd 'G' case (insert right after line 341): if (After_Next_Letter != '\0' && !isvowel(After_Next_Letter) { // 'gh' followed by consonant, as in 'knight' /* silent */ } else Thanks! Reproduce code: --------------- <?php echo metaphone('school'), '<br />'; echo metaphone('character'), '<br />'; echo metaphone('ghent'), '<br />'; echo metaphone('knight'), '<br />'; ?> Expected result: ---------------- SKL KRKTR KNT NT Actual result: -------------- SXL XRKTR FNT NFT -- Edit bug report at http://bugs.php.net/?id=48711&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48711&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48711&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48711&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48711&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48711&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48711&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48711&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48711&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48711&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48711&r=support Expected behavior: http://bugs.php.net/fix.php?id=48711&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48711&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48711&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48711&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48711&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48711&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48711&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48711&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48711&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48711&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48711&r=mysqlcfg