php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60123 Metaphone returns string longer than limit
Submitted: 2011-10-24 15:43 UTC Modified: 2011-11-16 00:54 UTC
From: gravisoft at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.8 OS: Windows XP SP3
Private report: No CVE-ID: None
 [2011-10-24 15:43 UTC] gravisoft at gmail dot com
Description:
------------
The metaphone function accepts two parameters: an input string, and a string length limit.  With certain input, it is possible to cause metaphone to return a string longer than the specified limit.
The issue seems to arise when the string is nearing it's length limit and the following input character is an X, which can translate to a KS, pushing the string over its limit.

Test script:
---------------
<?php

var_dump( metaphone('administratrix', 10) );
var_dump( metaphone('asterix', 5) );

?>

Expected result:
----------------
string(10) "ATMNSTRTRK"
string(5) "ASTRK"

Actual result:
--------------
string(11) "ATMNSTRTRKS"
string(6) "ASTRKS"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-16 00:54 UTC] felipe@php.net
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 isn't an 'string length limit', but the max number of phonemes. X -> KS
 [2011-11-16 00:54 UTC] felipe@php.net
-Status: Open +Status: Bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC