Commit 4b26ff1698b for php.net

commit 4b26ff1698b96e00682a2afd063ff01dc915d478
Author: Weilin Du <weilindu@php.net>
Date:   Tue Aug 11 03:02:18 2026 +0800

    RFC: Deprecate metaphone() (#21889)

    This implement RFC:
    https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_metaphone_function
    which deprecate the metaphone function.

diff --git a/NEWS b/NEWS
index 2d6cde54b32..7bbc50fcccf 100644
--- a/NEWS
+++ b/NEWS
@@ -94,6 +94,7 @@ PHP                                                                        NEWS
   . Added the "filter.max_filter_count" stream context option for php://filter
     URLs. Using more than 16 filters without configuring this option is now
     deprecated. (Sjoerd Langkemper)
+  . metaphone() is now deprecated. (Weilin Du)
   . Improved performance of array_intersect(). (mehmetcansahin)
   . Fixed bug GH-23006 (phpcredits() full-page HTML title says phpinfo()).
     (Weilin Du)
diff --git a/UPGRADING b/UPGRADING
index ad7f51bdeb2..754157e75b2 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -490,6 +490,9 @@ PHP 8.6 UPGRADE NOTES
     RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_arrayiterator_methods_that_inherit_arrayobject_implementation

 - Standard:
+  . metaphone() is deprecated.
+    Please use a userland phonetic matching library instead.
+    RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_metaphone_function
   . Using more than 16 filters in a php://filter URL without configuring the
     "filter.max_filter_count" stream context option now emits an E_DEPRECATED
     warning. Use stream_filter_append() or configure this option explicitly.
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index fb7c5b90fdb..9f52df10e1d 100644
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -2239,6 +2239,7 @@ function inet_pton(string $ip): string|false {}
 /* metaphone.c */

 /** @refcount 1 */
+#[\Deprecated(since: '8.6', message: 'use a userland phonetic matching library instead')]
 function metaphone(string $string, int $max_phonemes = 0): string {}

 /* {{{ head.c */
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index c352ef20a40..4f0434b9d8a 100644
Binary files a/ext/standard/basic_functions_arginfo.h and b/ext/standard/basic_functions_arginfo.h differ
diff --git a/ext/standard/basic_functions_decl.h b/ext/standard/basic_functions_decl.h
index 159d30b2c00..40e4c918ba6 100644
Binary files a/ext/standard/basic_functions_decl.h and b/ext/standard/basic_functions_decl.h differ
diff --git a/ext/standard/tests/GHSA-96wq-48vp-hh57.phpt b/ext/standard/tests/GHSA-96wq-48vp-hh57.phpt
index f8a01f48a11..d9aa9af6a47 100644
--- a/ext/standard/tests/GHSA-96wq-48vp-hh57.phpt
+++ b/ext/standard/tests/GHSA-96wq-48vp-hh57.phpt
@@ -18,5 +18,6 @@

 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 ===DONE===
diff --git a/ext/standard/tests/strings/bug44242.phpt b/ext/standard/tests/strings/bug44242.phpt
index 00adda2be67..78e371abaad 100644
--- a/ext/standard/tests/strings/bug44242.phpt
+++ b/ext/standard/tests/strings/bug44242.phpt
@@ -8,7 +8,12 @@
 echo metaphone('CMXFXZXZ'), "\n";

 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 KMKSFKSS
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 KMKSFKSF
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 KMKSFKSSKSS
diff --git a/ext/standard/tests/strings/bug47443.phpt b/ext/standard/tests/strings/bug47443.phpt
index e673e807ee8..de7d1448302 100644
--- a/ext/standard/tests/strings/bug47443.phpt
+++ b/ext/standard/tests/strings/bug47443.phpt
@@ -8,7 +8,12 @@
 var_dump(metaphone("scratc"));

 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(4) "SKRX"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(4) "SKR0"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(5) "SKRTK"
diff --git a/ext/standard/tests/strings/bug48709.phpt b/ext/standard/tests/strings/bug48709.phpt
index 9e0789a61f2..65e42dd58c6 100644
--- a/ext/standard/tests/strings/bug48709.phpt
+++ b/ext/standard/tests/strings/bug48709.phpt
@@ -20,12 +20,27 @@
 }

 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 kn => N
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 gn => N
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 pn => N
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 ae => E
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 wr => R
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 x => S
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 wh => W
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 wa => W
diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt
index 6b8f5c1c89d..bb2d30adf94 100644
--- a/ext/standard/tests/strings/metaphone.phpt
+++ b/ext/standard/tests/strings/metaphone.phpt
@@ -27,14 +27,31 @@

 echo "Done\n";
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(0) ""
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(0) ""
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 metaphone(): Argument #2 ($max_phonemes) must be greater than or equal to 0
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(6) "FLTFRS"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(6) "FLTFRS"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(26) "0FLFRWRTKRFLNKHTLSLN0KLTR0"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(56) "BT0XTFHRRHLTNTRTRNTPSNKLWRNRFTBF0MSWPNK0FNRKW0TSFSTLWNKS"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(69) "ANT0NTWSKNFLYNKBKTMRTRW00SPTF0R0FSRNNTBHNTT0WNTRRTWLFNK0TTMRXSBRNTBLK"
+
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
 string(56) "0NKTWSTSFRS0YKLTPRSFNT0TSTNTMNSF0MNTNSWSTPLTW00FTFLMNLFT"
 Done
diff --git a/ext/standard/tests/strings/metaphone_deprecation.phpt b/ext/standard/tests/strings/metaphone_deprecation.phpt
new file mode 100644
index 00000000000..6e83b7abc03
--- /dev/null
+++ b/ext/standard/tests/strings/metaphone_deprecation.phpt
@@ -0,0 +1,11 @@
+--TEST--
+metaphone() deprecation
+--FILE--
+<?php
+
+var_dump(metaphone("programming"));
+
+?>
+--EXPECTF--
+Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in %s on line %d
+string(7) "PRKRMNK"