From 464e8772b20d7a0aed9a42c551bc938b69aaefde Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Fri, 16 Oct 2026 15:57:33 +0800 Subject: [PATCH] ext/standard: Use fast ZPP in levenshtein() --- ext/standard/levenshtein.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c index efc71d2a2828..9ac7689d3bf5 100644 --- a/ext/standard/levenshtein.c +++ b/ext/standard/levenshtein.c @@ -80,10 +80,14 @@ PHP_FUNCTION(levenshtein) zend_long cost_rep = 1; zend_long cost_del = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|lll", &string1, &string2, &cost_ins, &cost_rep, &cost_del) == FAILURE) { - RETURN_THROWS(); - } - + ZEND_PARSE_PARAMETERS_START(2, 5) + Z_PARAM_STR(string1) + Z_PARAM_STR(string2) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(cost_ins) + Z_PARAM_LONG(cost_rep) + Z_PARAM_LONG(cost_del) + ZEND_PARSE_PARAMETERS_END(); RETURN_LONG(reference_levdist(string1, string2, cost_ins, cost_rep, cost_del)); }