|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-11-16 20:52 UTC] gravisoft at gmail dot com
Description:
------------
Under certain conditions, the metaphone function returns fewer phonemes than the $phonemes parameter specifies. This is an edge-case occurrence when dealing with an X near the end of the specified phoneme count.
For the test script, the following phoneme transformations take place:
A -> A
X -> KS
C -> K
Test script:
---------------
<?php
var_dump('axccc', 2); // Should produce AKS
var_dump('axccc', 3); // Should produce AKSK as "X->KS" is one phoneme
var_dump('axccc', 0); // Should produce AKSKKK
?>
Expected result:
----------------
string(3) "AKS"
string(4) "AKSK"
string(6) "AKSKKK"
Actual result:
--------------
string(3) "AKS"
string(3) "AKS"
string(6) "AKSKKK"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
This doesn't have anything to do with it "going over" the phoneme limit parameter, it's about it translating too few phonemes. If you're defining (X -> KS) as one phoneme, then metpahone('axc', 3) == 'AKS' is incorrect because it only translated (A -> A) and (X -> KS) which is two phonemes. Translating three phonemes - (A->A), (X->KS), (C->K) - should have yielded 'AKSK'. If you're defining each K and S from (X -> KS) as a phoneme, then metaphone('axc', 2) == 'AKS' is incorrect as per bug #60123 (going over restricted number of phoneme characters). If that isn't a bug, then the documentation should be modified to note it as such. Regardless, something is amiss here.