Skip to content

Commit 1eb14ee

Browse files
committed
Merge branch 'PHP-8.2'
2 parents dfec0e4 + bb16c2e commit 1eb14ee

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

ext/intl/spoofchecker/spoofchecker_main.c

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

5555
if (error_code) {
5656
zval_ptr_dtor(error_code);
57-
ZVAL_LONG(error_code, ret);
57+
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
58+
Z_TRY_ADDREF_P(error_code);
5859
}
5960
RETVAL_BOOL(ret != 0);
6061
}
@@ -87,7 +88,8 @@ PHP_METHOD(Spoofchecker, areConfusable)
8788

8889
if (error_code) {
8990
zval_ptr_dtor(error_code);
90-
ZVAL_LONG(error_code, ret);
91+
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
92+
Z_TRY_ADDREF_P(error_code);
9193
}
9294
RETVAL_BOOL(ret != 0);
9395
}

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)