Skip to content

Commit 7f0d257

Browse files
committed
Simplify a-vis error message
1 parent 407bc09 commit 7f0d257

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Zend/tests/asymmetric_visibility/virtual_get_only.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Foo {
1111

1212
?>
1313
--EXPECTF--
14-
Fatal error: Unilateral virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
14+
Fatal error: Read-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d

Zend/tests/asymmetric_visibility/virtual_set_only.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Foo {
1111

1212
?>
1313
--EXPECTF--
14-
Fatal error: Unilateral virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
14+
Fatal error: Write-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d

Zend/zend_inheritance.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,8 +1709,11 @@ ZEND_API void zend_verify_hooked_property(zend_class_entry *ce, zend_property_in
17091709
if ((prop_info->flags & ZEND_ACC_VIRTUAL)
17101710
&& (prop_info->flags & ZEND_ACC_PPP_SET_MASK)
17111711
&& (!prop_info->hooks[ZEND_PROPERTY_HOOK_GET] || !prop_info->hooks[ZEND_PROPERTY_HOOK_SET])) {
1712+
const char *prefix = !prop_info->hooks[ZEND_PROPERTY_HOOK_GET]
1713+
? "Write-only" : "Read-only";
17121714
zend_error_noreturn(E_COMPILE_ERROR,
1713-
"Unilateral virtual property %s::$%s must not specify asymmetric visibility", ZSTR_VAL(ce->name), ZSTR_VAL(prop_name));
1715+
"%s virtual property %s::$%s must not specify asymmetric visibility",
1716+
prefix, ZSTR_VAL(ce->name), ZSTR_VAL(prop_name));
17141717
}
17151718
}
17161719

0 commit comments

Comments
 (0)