Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ PHP NEWS
(Weilin Du)
. getenv() and putenv() now raises a ValueError when the first argument
contains null bytes. (Weilin Du)
. metaphone() is now deprecated. (Weilin Du)

- Streams:
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream
Expand Down
5 changes: 5 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ PHP 8.6 UPGRADE NOTES
4. Deprecated Functionality
========================================

- Standard:
. metaphone() is deprecated.
Please use a userland phonetic matching library instead.
RFC: https://wiki.php.net/rfc/deprecate-metaphone

========================================
5. Changed Functions
========================================
Expand Down
1 change: 1 addition & 0 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,7 @@ function inet_pton(string $ip): string|false {}
/* metaphone.c */

/** @refcount 1 */
#[\Deprecated(since: '8.6')]
function metaphone(string $string, int $max_phonemes = 0): string {}

/* {{{ head.c */
Expand Down
9 changes: 7 additions & 2 deletions ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/standard/basic_functions_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ext/standard/tests/strings/bug44242.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Bug #44242 (metaphone('CMXFXM') crashes PHP)
--FILE--
<?php

echo metaphone('CMXFXZ'), "\n";
echo metaphone('CMXFXV'), "\n";
echo metaphone('CMXFXZXZ'), "\n";
echo @metaphone('CMXFXZ'), "\n";
echo @metaphone('CMXFXV'), "\n";
echo @metaphone('CMXFXZXZ'), "\n";

?>
--EXPECT--
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/tests/strings/bug47443.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Bug #47443 (metaphone('scratch') returns wrong result)
--FILE--
<?php

var_dump(metaphone("scratch"));
var_dump(metaphone("scrath"));
var_dump(metaphone("scratc"));
var_dump(@metaphone("scratch"));
var_dump(@metaphone("scrath"));
var_dump(@metaphone("scratc"));

?>
--EXPECT--
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/strings/bug48709.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $exceptions = array(
);

foreach ($exceptions as $letter) {
printf("%s => %s\n", $letter, metaphone($letter));
printf("%s => %s\n", $letter, @metaphone($letter));
}

?>
Expand Down
12 changes: 6 additions & 6 deletions ext/standard/tests/strings/metaphone.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ metaphone() tests
--FILE--
<?php

var_dump(metaphone(""));
var_dump(metaphone(-1));
var_dump(@metaphone(""));
var_dump(@metaphone(-1));

try {
var_dump(metaphone("valid phrase", -1));
var_dump(@metaphone("valid phrase", -1));
} catch (ValueError $e) {
echo $e->getMessage(), "\n";
}
var_dump(metaphone("valid phrase", 0));
var_dump(metaphone("valid phrase", 10000));
var_dump(@metaphone("valid phrase", 0));
var_dump(@metaphone("valid phrase", 10000));

$array = array(
"They fell forward, grovelling heedlessly on the cold earth.",
Expand All @@ -22,7 +22,7 @@ $array = array(
);

foreach($array as $str) {
var_dump(metaphone($str));
var_dump(@metaphone($str));
}

echo "Done\n";
Expand Down
11 changes: 11 additions & 0 deletions ext/standard/tests/strings/metaphone_deprecation.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
metaphone() deprecation
--FILE--
<?php

var_dump(metaphone("programming"));

?>
--EXPECTF--
Deprecated: Function metaphone() is deprecated since 8.6 in %s on line %d
string(7) "PRKRMNK"
Loading