Skip to content

Commit bb16c2e

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
2 parents 9995514 + 0a466e7 commit bb16c2e

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ PHP NEWS
3737
- GMP:
3838
. Properly implement GMP::__construct(). (nielsdos)
3939

40+
- Intl:
41+
. Fixed bug GH-10647 (Spoolchecker isSuspicious/areConfusable methods
42+
error code's argument always returning NULL0. (Nathan Freeman)
43+
4044
- JSON:
4145
. Fixed JSON scanner and parser generation build.
4246
(Daniel Black, Jakub Zelenka)

ext/intl/spoofchecker/spoofchecker_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ PHP_METHOD(Spoofchecker, isSuspicious)
4343

4444
if (error_code) {
4545
zval_ptr_dtor(error_code);
46-
ZVAL_LONG(error_code, ret);
46+
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
47+
Z_TRY_ADDREF_P(error_code);
4748
}
4849
RETVAL_BOOL(ret != 0);
4950
}
@@ -76,7 +77,8 @@ PHP_METHOD(Spoofchecker, areConfusable)
7677

7778
if (error_code) {
7879
zval_ptr_dtor(error_code);
79-
ZVAL_LONG(error_code, ret);
80+
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
81+
Z_TRY_ADDREF_P(error_code);
8082
}
8183
RETVAL_BOOL(ret != 0);
8284
}

ext/intl/tests/gh10647.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug GH-10647 (Spoofchecker::isSuspicious $errorCode always null)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("intl")) die("skip intl extension not available");
6+
?>
7+
--FILE--
8+
<?php
9+
$error = 123;
10+
var_dump($error);
11+
12+
$x = new Spoofchecker();
13+
var_dump($x->isSuspicious("\u{041F}aypal.com", $error));
14+
var_dump($error);
15+
16+
var_dump($x->areConfusable('google.com', 'goog1e.com', $error));
17+
var_dump($error);
18+
?>
19+
--EXPECTF--
20+
int(123)
21+
bool(true)
22+
int(%d)
23+
bool(true)
24+
int(%d)

0 commit comments

Comments
 (0)