Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/tests/asymmetric_visibility/virtual_get_only.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class Foo {

?>
--EXPECTF--
Fatal error: Read-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
Fatal error: get-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/asymmetric_visibility/virtual_set_only.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class Foo {

?>
--EXPECTF--
Fatal error: Write-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
Fatal error: set-only virtual property Foo::$bar must not specify asymmetric visibility in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/bug001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ try {
?>
--EXPECT--
bool(true)
Property C::$x is read-only
Cannot write to get-only virtual property C::$x
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/bug008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $foo->bar = 'bar';

?>
--EXPECTF--
Fatal error: Uncaught Error: Property Foo::$bar is read-only in %s:%d
Fatal error: Uncaught Error: Cannot write to get-only virtual property Foo::$bar in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/get.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ try {
?>
--EXPECT--
int(42)
Property Test::$prop is read-only
Cannot write to get-only virtual property Test::$prop
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/override_add_get.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var_dump($b->prop);
?>
--EXPECT--
A::A::$prop::set
Property A::$prop is write-only
Cannot read from set-only virtual property A::$prop
B::B::$prop::set
B::B::$prop::get
int(42)
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/override_add_set.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var_dump($b->prop);

?>
--EXPECT--
Property A::$prop is read-only
Cannot write to get-only virtual property A::$prop
A::A::$prop::get
int(42)
B::B::$prop::set
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/property_hooks/set.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ try {
?>
--EXPECT--
int(42)
Property Test::$prop is write-only
Property Test::$prop is write-only
Cannot read from set-only virtual property Test::$prop
Cannot read from set-only virtual property Test::$prop
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/type_compatibility.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Relaxed type compatibility for read-only and write-only properties
Relaxed type compatibility for get-only and set-only properties
--FILE--
<?php

Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/property_hooks/type_compatibility_invalid.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
Invalid type compatibility for read-only property
Invalid type compatibility for get-only property
--FILE--
<?php

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ ZEND_API void zend_verify_hooked_property(const zend_class_entry *ce, zend_prope
&& (prop_info->flags & ZEND_ACC_PPP_SET_MASK)
&& (!prop_info->hooks[ZEND_PROPERTY_HOOK_GET] || !prop_info->hooks[ZEND_PROPERTY_HOOK_SET])) {
const char *prefix = !prop_info->hooks[ZEND_PROPERTY_HOOK_GET]
? "Write-only" : "Read-only";
? "set-only" : "get-only";
zend_error_noreturn(E_COMPILE_ERROR,
"%s virtual property %s::$%s must not specify asymmetric visibility",
prefix, ZSTR_VAL(ce->name), ZSTR_VAL(prop_name));
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
zend_function *get = prop_info->hooks[ZEND_PROPERTY_HOOK_GET];
if (!get) {
if (prop_info->flags & ZEND_ACC_VIRTUAL) {
zend_throw_error(NULL, "Property %s::$%s is write-only",
zend_throw_error(NULL, "Cannot read from set-only virtual property %s::$%s",
ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
return &EG(uninitialized_zval);
}
Expand Down Expand Up @@ -1150,7 +1150,7 @@ found:;

if (!set) {
if (prop_info->flags & ZEND_ACC_VIRTUAL) {
zend_throw_error(NULL, "Property %s::$%s is read-only", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
zend_throw_error(NULL, "Cannot write to get-only virtual property %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
variable_ptr = &EG(error_zval);
goto exit;
}
Expand Down Expand Up @@ -2343,7 +2343,7 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has

if (!get) {
if (prop_info->flags & ZEND_ACC_VIRTUAL) {
zend_throw_error(NULL, "Property %s::$%s is write-only",
zend_throw_error(NULL, "Cannot read from set-only virtual property %s::$%s",
ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
return 0;
} else {
Expand Down