Skip to content

Commit 4e66e6a

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fixed bug #80173
2 parents 2efee44 + bdc60fa commit 4e66e6a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ PHP NEWS
1313
the process). (Calvin Buckley)
1414
. Fixed bug #73630 (Built-in Weberver - overwrite $_SERVER['request_uri']).
1515
(cmb)
16+
. Fixed bug #80173 (Using return value of zend_assign_to_variable() is not
17+
safe). (Nikita)
1618

1719
- Intl:
1820
. Fixed bug #72809 (Locale::lookup() wrong result with canonicalize option).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Using return of property assignment to reference that destroys object
3+
--FILE--
4+
<?php
5+
6+
$a = new stdClass;
7+
$a->a =& $a;
8+
var_dump($a->a = 0);
9+
10+
?>
11+
--EXPECT--
12+
int(0)

Zend/zend_object_handlers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ ZEND_API zval *zend_std_write_property(zend_object *zobj, zend_string *name, zva
723723
}
724724

725725
found:
726-
zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, property_uses_strict_types());
726+
variable_ptr = zend_assign_to_variable(
727+
variable_ptr, value, IS_TMP_VAR, property_uses_strict_types());
727728
goto exit;
728729
}
729730
if (Z_PROP_FLAG_P(variable_ptr) == IS_PROP_UNINIT) {

0 commit comments

Comments
 (0)