php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39559 Levenstein.c gives spurious additional warning if custom_levdist is called
Submitted: 2006-11-20 15:39 UTC Modified: 2006-11-21 17:43 UTC
From: zoe dot slattery at googlemail dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 5CVS-2006-11-20 (snap) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zoe dot slattery at googlemail dot com
New email:
PHP Version: OS:

 

 [2006-11-20 15:39 UTC] zoe dot slattery at googlemail dot com
Description:
------------
I started by modifying the levenshtein test function ext/standard/tests/general_functions/003.phpt to cover the case where custom_levdist is called and to add some checks that the behviour is correct if strings > 255 chars are passed to levenshtein.c

A patch to the test case is provided here:
http://pastebin.ca/253241

the new test case covers >90% of the code.

Unfortunately the new test case showed that when custom_levdist is called two warnings are issued. The first of these warns correctly that "The general Levenstein support is not there yet", the second warning ("Arguments strings(s) too long") is issued incorrectly.

I have attached a suggested patch to ext/standard/levenshtein.c here (http://pastebin.ca/253242) which corrects this.


Reproduce code:
---------------
The way to reproduce is to use the modified testcase - linked above.

Note that I have also modified the tescase to expect a return code of -2 from custom_levdist (rather than -1) 

Expected result:
----------------
Warning "The general Levenshtein support is not there yet"

Actual result:
--------------
Warning "The general Levenshtein support is not there yet"
Warning "Argument string(s) too long"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-20 16:23 UTC] tony2001@php.net
Please put the testcase somewhere and paste the URL here.
Applying copy/pasted patches is not trivial.
 [2006-11-21 17:08 UTC] zoe dot slattery at googlemail dot com
Apologies for making this harder than it should be.

Here is a link to the test case that fails when run against the PHP 5.2 snap.http://pastebin.ca/254179.

Here is a link to teh version of the test case that matches the suggested fix to levenshtein.c. This test case matches the diff to ext/standard/tests/general_functions/003.phpt that I submitted originally.
http://pastebin.ca/254187
 [2006-11-21 17:43 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Dec 05 04:05:52 2022 UTC