mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Fix leak in typed reference assignment
We're only creating tmp here to compare against the existing coerced_value. We need to destroy it in all cases.
This commit is contained in:
parent
e701146070
commit
a2bbd8f01f
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Do not leak when assigning to reference set with multiple typed properties with type coercion
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
public string $x;
|
||||
public string $y;
|
||||
}
|
||||
|
||||
$test = new Test;
|
||||
$ref = "";
|
||||
$test->x =& $ref;
|
||||
$test->y =& $ref;
|
||||
$val = 42;
|
||||
$ref = $val;
|
||||
var_dump($ref, $val);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "42"
|
||||
int(42)
|
@ -3133,6 +3133,7 @@ type_error:
|
||||
zval_ptr_dtor(&tmp);
|
||||
goto conflicting_coercion_error;
|
||||
}
|
||||
zval_ptr_dtor(&tmp);
|
||||
}
|
||||
} else {
|
||||
if (!first_prop) {
|
||||
|
Loading…
Reference in New Issue
Block a user