Bug #60314 [Opn->Bgs]: Metaphone returns fewer phonemes than defined
Edit report at https://bugs.php.net/bug.php?id=60314&edit=1
ID: 60314
Updated by: felipe@php.net
Reported by: gravisoft at gmail dot com
Summary: Metaphone returns fewer phonemes than defined
-Status: Open
+Status: Bogus
Type: Bug
-Package: Unknown/Other Function
+Package: Strings related
Operating System: Windows XP SP3
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
It works following the Text-Metaphone CPAN package, it stop decoding when reach the limit of
phonems, but when decoding the last char it can pass the limit suplied, because this
metaphone('AX', 2) == metaphone('AXC', 3).
Previous Comments:
------------------------------------------------------------------------
[2011-11-16 20:52:15] 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"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60314&edit=1
Thread (4 messages)