Bug #80073 [Com]: levenshthein(): warning/error not documented

From: Date: Mon, 07 Sep 2020 09:52:13 +0000
Subject: Bug #80073 [Com]: levenshthein(): warning/error not documented
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17869@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80073&edit=1

 ID:                 80073
 Comment by:         claude dot pache at gmail dot com
 Reported by:        claude dot pache at gmail dot com
 Summary:            levenshthein(): warning/error not documented
 Status:             Open
 Type:               Bug
 Package:            Documentation problem
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Moreover, the change of behaviour of levenshthein() between PHP 7 and PHP 8 (which is a BC break) is
currently not documented in UPGRADING:

https://github.com/php/php-src/blob/php-8.0.0beta3/UPGRADING


Previous Comments:
------------------------------------------------------------------------
[2020-09-07 09:38:16] claude dot pache at gmail dot com

Description:
------------
In the manual page:

https://www.php.net/manual/function.levenshtein.php

it is stated that levenshtein() returns -1 if one argument is too long, but it doesn’t say that
an error is emitted.

Test script:
---------------
var_dump(levenshtein(str_repeat('X', 300), 'a'));

Expected result:
----------------
Per the manual page; dumps -1 without warning/error.

Actual result:
--------------
In PHP 7: Emits a Warning and dumps -1.

In PHP 8: Throws a ValueError.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80073&edit=1


Thread (4 messages)

« previous php.doc.bugs (#17869) next »