Skip to content

Commit 7fad431

Browse files
committed
initial version 1.0
1 parent ea67883 commit 7fad431

8 files changed

Lines changed: 31 additions & 13 deletions

File tree

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ PHP NEWS
179179
(Weilin Du)
180180
. getenv() and putenv() now raises a ValueError when the first argument
181181
contains null bytes. (Weilin Du)
182+
. metaphone() is now deprecated. (Weilin Du)
182183

183184
- Streams:
184185
. Added so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt stream

UPGRADING

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ PHP 8.6 UPGRADE NOTES
154154
4. Deprecated Functionality
155155
========================================
156156

157+
- Standard:
158+
. metaphone() is deprecated.
159+
Please use a userland phonetic matching library instead.
160+
RFC: https://wiki.php.net/rfc/deprecate-metaphone
161+
157162
========================================
158163
5. Changed Functions
159164
========================================

ext/standard/basic_functions.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,7 @@ function inet_pton(string $ip): string|false {}
22392239
/* metaphone.c */
22402240

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

22442245
/* {{{ head.c */

ext/standard/tests/strings/bug44242.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Bug #44242 (metaphone('CMXFXM') crashes PHP)
33
--FILE--
44
<?php
55

6-
echo metaphone('CMXFXZ'), "\n";
7-
echo metaphone('CMXFXV'), "\n";
8-
echo metaphone('CMXFXZXZ'), "\n";
6+
echo @metaphone('CMXFXZ'), "\n";
7+
echo @metaphone('CMXFXV'), "\n";
8+
echo @metaphone('CMXFXZXZ'), "\n";
99

1010
?>
1111
--EXPECT--

ext/standard/tests/strings/bug47443.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Bug #47443 (metaphone('scratch') returns wrong result)
33
--FILE--
44
<?php
55

6-
var_dump(metaphone("scratch"));
7-
var_dump(metaphone("scrath"));
8-
var_dump(metaphone("scratc"));
6+
var_dump(@metaphone("scratch"));
7+
var_dump(@metaphone("scrath"));
8+
var_dump(@metaphone("scratc"));
99

1010
?>
1111
--EXPECT--

ext/standard/tests/strings/bug48709.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $exceptions = array(
1616
);
1717

1818
foreach ($exceptions as $letter) {
19-
printf("%s => %s\n", $letter, metaphone($letter));
19+
printf("%s => %s\n", $letter, @metaphone($letter));
2020
}
2121

2222
?>

ext/standard/tests/strings/metaphone.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ metaphone() tests
33
--FILE--
44
<?php
55

6-
var_dump(metaphone(""));
7-
var_dump(metaphone(-1));
6+
var_dump(@metaphone(""));
7+
var_dump(@metaphone(-1));
88

99
try {
10-
var_dump(metaphone("valid phrase", -1));
10+
var_dump(@metaphone("valid phrase", -1));
1111
} catch (ValueError $e) {
1212
echo $e->getMessage(), "\n";
1313
}
14-
var_dump(metaphone("valid phrase", 0));
15-
var_dump(metaphone("valid phrase", 10000));
14+
var_dump(@metaphone("valid phrase", 0));
15+
var_dump(@metaphone("valid phrase", 10000));
1616

1717
$array = array(
1818
"They fell forward, grovelling heedlessly on the cold earth.",
@@ -22,7 +22,7 @@ $array = array(
2222
);
2323

2424
foreach($array as $str) {
25-
var_dump(metaphone($str));
25+
var_dump(@metaphone($str));
2626
}
2727

2828
echo "Done\n";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
metaphone() deprecation
3+
--FILE--
4+
<?php
5+
6+
var_dump(metaphone("programming"));
7+
8+
?>
9+
--EXPECTF--
10+
Deprecated: Function metaphone() is deprecated since 8.6 in %s on line %d
11+
string(7) "PRKRMNK"

0 commit comments

Comments
 (0)