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

From: Date: Mon, 20 Nov 2006 16:23:24 +0000
Subject: #39559 [Opn->Fbk]: 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-105204@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: Feedback Bug Type: Unknown/Other Function Operating System: Linux PHP Version: 5CVS-2006-11-20 (snap) New Comment: Please put the testcase somewhere and paste the URL here. Applying copy/pasted patches is not trivial. Previous Comments: ------------------------------------------------------------------------ [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 (#105204) next »