#39559 [Opn->Csd]: Levenstein.c gives spurious additional warning if custom_levdist is called

From: Date: Tue, 21 Nov 2006 17:43:06 +0000
Subject: #39559 [Opn->Csd]: Levenstein.c gives spurious additional warning if custom_levdist is called
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105262@lists.php.net to get a copy of this message
ID: 39559 Updated by: tony2001@php.net Reported By: zoe dot slattery at googlemail dot com -Status: Open +Status: Closed Bug Type: Unknown/Other Function Operating System: Linux PHP Version: 5CVS-2006-11-20 (snap) New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2006-11-21 17:08:36] 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-20 16:23:23] tony2001@php.net Please put the testcase somewhere and paste the URL here. Applying copy/pasted patches is not trivial. ------------------------------------------------------------------------ [2006-11-20 15:39:12] 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" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39559&edit=1

« previous php.bugs (#105262) next »