mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix reference handling in SpoofChecker
This commit is contained in:
commit
c87f29f685
3
NEWS
3
NEWS
@ -18,6 +18,9 @@ PHP NEWS
|
||||
- DOM:
|
||||
. Fixed bug GH-14343 (Memory leak in xml and dom). (nielsdos)
|
||||
|
||||
- Intl:
|
||||
. Fix reference handling in SpoofChecker. (nielsdos)
|
||||
|
||||
- MySQLnd:
|
||||
. Partially fix bug GH-10599 (Apache crash on Windows when using a
|
||||
self-referencing anonymous function inside a class with an active
|
||||
|
@ -53,9 +53,7 @@ PHP_METHOD(Spoofchecker, isSuspicious)
|
||||
}
|
||||
|
||||
if (error_code) {
|
||||
zval_ptr_dtor(error_code);
|
||||
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
|
||||
Z_TRY_ADDREF_P(error_code);
|
||||
ZEND_TRY_ASSIGN_REF_LONG(error_code, ret);
|
||||
}
|
||||
RETVAL_BOOL(ret != 0);
|
||||
}
|
||||
@ -87,9 +85,7 @@ PHP_METHOD(Spoofchecker, areConfusable)
|
||||
}
|
||||
|
||||
if (error_code) {
|
||||
zval_ptr_dtor(error_code);
|
||||
ZVAL_LONG(Z_REFVAL_P(error_code), ret);
|
||||
Z_TRY_ADDREF_P(error_code);
|
||||
ZEND_TRY_ASSIGN_REF_LONG(error_code, ret);
|
||||
}
|
||||
RETVAL_BOOL(ret != 0);
|
||||
}
|
||||
|
18
ext/intl/tests/spoofchecker_self_references.phpt
Normal file
18
ext/intl/tests/spoofchecker_self_references.phpt
Normal file
@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
SpoofChecker with self references
|
||||
--EXTENSIONS--
|
||||
intl
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$checker = new Spoofchecker();
|
||||
$checker->isSuspicious("", $checker);
|
||||
|
||||
$checker = new Spoofchecker();
|
||||
$checker->areConfusable("", "", $checker);
|
||||
|
||||
echo "Done\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
35
ext/intl/tests/spoofchecker_typed_references.phpt
Normal file
35
ext/intl/tests/spoofchecker_typed_references.phpt
Normal file
@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
SpoofChecker with typed references
|
||||
--EXTENSIONS--
|
||||
intl
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public string $x;
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
$test->x = "";
|
||||
|
||||
$checker = new Spoofchecker();
|
||||
$checker->isSuspicious("", $test->x);
|
||||
var_dump($test);
|
||||
|
||||
$test = new Test;
|
||||
$test->x = "";
|
||||
|
||||
$checker = new Spoofchecker();
|
||||
$checker->areConfusable("", "", $test->x);
|
||||
var_dump($test);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(Test)#1 (1) {
|
||||
["x"]=>
|
||||
string(1) "0"
|
||||
}
|
||||
object(Test)#3 (1) {
|
||||
["x"]=>
|
||||
string(1) "1"
|
||||
}
|
Loading…
Reference in New Issue
Block a user