Skip to content

Commit ebe358c

Browse files
committed
Code review fixes
1 parent 40ef5b8 commit ebe358c

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

Zend/tests/readonly_props/readonly_assign_no_sideeffect.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class Foo {
88
public readonly string $bar
99
) {}
1010

11-
public function write()
12-
{
11+
public function write() {
1312
$this->bar = new S();
1413
}
1514
}

Zend/zend_execute.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,9 +1009,7 @@ static zend_never_inline zval* zend_assign_to_typed_prop(zend_property_info *inf
10091009
{
10101010
zval tmp;
10111011

1012-
if (UNEXPECTED(
1013-
(info->flags & ZEND_ACC_READONLY) && !(Z_PROP_FLAG_P(property_val) & IS_PROP_REINITABLE)
1014-
)) {
1012+
if (UNEXPECTED((info->flags & ZEND_ACC_READONLY) && !(Z_PROP_FLAG_P(property_val) & IS_PROP_REINITABLE))) {
10151013
zend_readonly_property_modification_error(info);
10161014
return &EG(uninitialized_zval);
10171015
}
@@ -1024,9 +1022,7 @@ static zend_never_inline zval* zend_assign_to_typed_prop(zend_property_info *inf
10241022
return &EG(uninitialized_zval);
10251023
}
10261024

1027-
if (UNEXPECTED(info->flags & ZEND_ACC_READONLY)) {
1028-
Z_PROP_FLAG_P(property_val) &= ~IS_PROP_REINITABLE;
1029-
}
1025+
Z_PROP_FLAG_P(property_val) &= ~IS_PROP_REINITABLE;
10301026

10311027
return zend_assign_to_variable(property_val, &tmp, IS_TMP_VAR, EX_USES_STRICT_TYPES());
10321028
}

Zend/zend_object_handlers.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,7 @@ ZEND_API zval *zend_std_write_property(zend_object *zobj, zend_string *name, zva
837837
variable_ptr = &EG(error_zval);
838838
goto exit;
839839
}
840-
if (UNEXPECTED(prop_info->flags & ZEND_ACC_READONLY)) {
841-
Z_PROP_FLAG_P(variable_ptr) &= ~IS_PROP_REINITABLE;
842-
}
840+
Z_PROP_FLAG_P(variable_ptr) &= ~IS_PROP_REINITABLE;
843841
value = &tmp;
844842
}
845843

0 commit comments

Comments
 (0)