Doc #79050 [Ver->Csd]: Levenshteins third argument not implemented and typed as string
| From: | cmb@php.net | Date: | Fri, 01 Jan 2021 16:14:31 +0000 |
| Subject: | Doc #79050 [Ver->Csd]: Levenshteins third argument not implemented and typed as string | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18346@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79050&edit=1
ID: 79050
Updated by: cmb@php.net
Reported by: php at conscribo dot nl
Summary: Levenshteins third argument not implemented and
typed as string
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Strings related
Operating System: Debian
PHP Version: 7.3.13
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Support for the third signature is completely removed as of PHP
8.0.0, so it doesn't make sense to document that signature, just
to state that it is not implemented.
Previous Comments:
------------------------------------------------------------------------
[2019-12-31 14:03:01] cmb@php.net
There is also the related feature request #34835.
------------------------------------------------------------------------
[2019-12-31 13:44:48] cmb@php.net
levenshtein() has actually three alternative signatures; the one
you're using in the test script is
levenshtein(string $str1, string $str2, string $callback_name): int
but this signature is still not implemented (that's why you're
getting the warning). Note that $callback_name is indeed a
string, not a callable.
------------------------------------------------------------------------
[2019-12-31 12:54:34] php at conscribo dot nl
Description:
------------
---
From manual page: https://php.net/function.levenshtein
---
The documentation states that arguments 3 to 5 support weights for various actions. These are not
implemented (not documented).
The documentation states the weights should be integers. Running with php strict_types reveals it
only accepts strings.
Test script:
---------------
<?php
declare(strict_types=1);
$str1 = 'abc';
$str2 = 'abcd';
echo levenshtein($str1, $str2, 0);
//output:
//PHP Fatal error: Uncaught TypeError: levenshtein() expects parameter 3 to be //string, integer
given
------
<?php
declare(strict_types=1);
$str1 = 'abc';
$str2 = 'abcd';
echo levenshtein($str1, $str2, '0');
//output:
// PHP Warning: levenshtein(): The general Levenshtein support is not there yet
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79050&edit=1