[PHP-BUG] Bug #60123 [NEW]: Metaphone returns string longer than limit

2011-10-24 Thread gravisoft at gmail dot com
From: 
Operating system: Windows XP SP3
PHP version:  5.3.8
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:Metaphone returns string longer than limit

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:
---


Expected result:

string(10) "ATMNSTRTRK"
string(5) "ASTRK"

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60123&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60123&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60123&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60123&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60123&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60123&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60123&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60123&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60123&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60123&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60123&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60123&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60123&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60123&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60123&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60123&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60123&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60123&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60123&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60123&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60123&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60123&r=mysqlcfg



[PHP-BUG] Bug #60314 [NEW]: Metaphone returns fewer phonemes than defined

2011-11-16 Thread gravisoft at gmail dot com
From: 
Operating system: Windows XP SP3
PHP version:  5.3.8
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:Metaphone returns fewer phonemes than defined

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:
---
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 bug report at https://bugs.php.net/bug.php?id=60314&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60314&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60314&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60314&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60314&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60314&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60314&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60314&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60314&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60314&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60314&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60314&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60314&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60314&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60314&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60314&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60314&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60314&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60314&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60314&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60314&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60314&r=mysqlcfg



Bug #60314 [Bgs]: Metaphone returns fewer phonemes than defined

2011-11-17 Thread gravisoft at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=60314&edit=1

 ID: 60314
 User updated by:gravisoft at gmail dot com
 Reported by:gravisoft at gmail dot com
 Summary:Metaphone returns fewer phonemes than defined
 Status: Bogus
 Type:   Bug
 Package:Strings related
 Operating System:   Windows XP SP3
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

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.


Previous Comments:

[2011-11-17 21:58:05] fel...@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 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).


[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:
---
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