Skip to content

Commit 826e403

Browse files
committed
Add $ before property name in error message
1 parent 04824aa commit 826e403

7 files changed

+32
-32
lines changed

ext/reflection/php_reflection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5438,7 +5438,7 @@ ZEND_METHOD(reflection_property, getValue)
54385438
if (!(ref->prop.flags & (ZEND_ACC_PUBLIC | ZEND_ACC_IMPLICIT_PUBLIC)) && intern->ignore_visibility == 0) {
54395439
name = _default_load_name(getThis());
54405440
zend_throw_exception_ex(reflection_exception_ptr, 0,
5441-
"Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
5441+
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
54425442
return;
54435443
}
54445444

@@ -5489,7 +5489,7 @@ ZEND_METHOD(reflection_property, setValue)
54895489
if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
54905490
name = _default_load_name(getThis());
54915491
zend_throw_exception_ex(reflection_exception_ptr, 0,
5492-
"Cannot access non-public member %s::%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
5492+
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
54935493
return;
54945494
}
54955495

ext/reflection/tests/ReflectionClass_getProperty_003.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ object(ReflectionProperty)#%d (2) {
110110
["class"]=>
111111
string(1) "A"
112112
}
113-
Cannot access non-public member C::protA
113+
Cannot access non-public member C::$protA
114114
--- (Reflecting on privA) ---
115115
Property privA does not exist
116116
--- (Reflecting on pubB) ---
@@ -128,7 +128,7 @@ object(ReflectionProperty)#%d (2) {
128128
["class"]=>
129129
string(1) "B"
130130
}
131-
Cannot access non-public member C::protB
131+
Cannot access non-public member C::$protB
132132
--- (Reflecting on privB) ---
133133
Property privB does not exist
134134
--- (Reflecting on pubC) ---
@@ -146,15 +146,15 @@ object(ReflectionProperty)#%d (2) {
146146
["class"]=>
147147
string(1) "C"
148148
}
149-
Cannot access non-public member C::protC
149+
Cannot access non-public member C::$protC
150150
--- (Reflecting on privC) ---
151151
object(ReflectionProperty)#%d (2) {
152152
["name"]=>
153153
string(5) "privC"
154154
["class"]=>
155155
string(1) "C"
156156
}
157-
Cannot access non-public member C::privC
157+
Cannot access non-public member C::$privC
158158
--- (Reflecting on doesntExist) ---
159159
Property doesntExist does not exist
160160
--- (Reflecting on A::pubC) ---
@@ -172,15 +172,15 @@ object(ReflectionProperty)#%d (2) {
172172
["class"]=>
173173
string(1) "A"
174174
}
175-
Cannot access non-public member A::protC
175+
Cannot access non-public member A::$protC
176176
--- (Reflecting on A::privC) ---
177177
object(ReflectionProperty)#%d (2) {
178178
["name"]=>
179179
string(5) "privC"
180180
["class"]=>
181181
string(1) "A"
182182
}
183-
Cannot access non-public member A::privC
183+
Cannot access non-public member A::$privC
184184
--- (Reflecting on B::pubC) ---
185185
object(ReflectionProperty)#%d (2) {
186186
["name"]=>
@@ -196,15 +196,15 @@ object(ReflectionProperty)#%d (2) {
196196
["class"]=>
197197
string(1) "B"
198198
}
199-
Cannot access non-public member B::protC
199+
Cannot access non-public member B::$protC
200200
--- (Reflecting on B::privC) ---
201201
object(ReflectionProperty)#%d (2) {
202202
["name"]=>
203203
string(5) "privC"
204204
["class"]=>
205205
string(1) "B"
206206
}
207-
Cannot access non-public member B::privC
207+
Cannot access non-public member B::$privC
208208
--- (Reflecting on c::pubC) ---
209209
object(ReflectionProperty)#%d (2) {
210210
["name"]=>
@@ -230,15 +230,15 @@ object(ReflectionProperty)#%d (2) {
230230
["class"]=>
231231
string(1) "C"
232232
}
233-
Cannot access non-public member C::protC
233+
Cannot access non-public member C::$protC
234234
--- (Reflecting on C::privC) ---
235235
object(ReflectionProperty)#%d (2) {
236236
["name"]=>
237237
string(5) "privC"
238238
["class"]=>
239239
string(1) "C"
240240
}
241-
Cannot access non-public member C::privC
241+
Cannot access non-public member C::$privC
242242
--- (Reflecting on X::pubC) ---
243243
Fully qualified property name X::pubC does not specify a base class of C
244244
--- (Reflecting on X::protC) ---

ext/reflection/tests/ReflectionClass_getProperty_004.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ object(ReflectionProperty)#%d (2) {
110110
["class"]=>
111111
string(1) "A"
112112
}
113-
Cannot access non-public member C::protA
113+
Cannot access non-public member C::$protA
114114
--- (Reflecting on privA) ---
115115
Property privA does not exist
116116
--- (Reflecting on pubB) ---
@@ -128,7 +128,7 @@ object(ReflectionProperty)#%d (2) {
128128
["class"]=>
129129
string(1) "B"
130130
}
131-
Cannot access non-public member C::protB
131+
Cannot access non-public member C::$protB
132132
--- (Reflecting on privB) ---
133133
Property privB does not exist
134134
--- (Reflecting on pubC) ---
@@ -146,15 +146,15 @@ object(ReflectionProperty)#%d (2) {
146146
["class"]=>
147147
string(1) "C"
148148
}
149-
Cannot access non-public member C::protC
149+
Cannot access non-public member C::$protC
150150
--- (Reflecting on privC) ---
151151
object(ReflectionProperty)#%d (2) {
152152
["name"]=>
153153
string(5) "privC"
154154
["class"]=>
155155
string(1) "C"
156156
}
157-
Cannot access non-public member C::privC
157+
Cannot access non-public member C::$privC
158158
--- (Reflecting on doesntExist) ---
159159
Property doesntExist does not exist
160160
--- (Reflecting on A::pubC) ---
@@ -172,15 +172,15 @@ object(ReflectionProperty)#%d (2) {
172172
["class"]=>
173173
string(1) "A"
174174
}
175-
Cannot access non-public member A::protC
175+
Cannot access non-public member A::$protC
176176
--- (Reflecting on A::privC) ---
177177
object(ReflectionProperty)#%d (2) {
178178
["name"]=>
179179
string(5) "privC"
180180
["class"]=>
181181
string(1) "A"
182182
}
183-
Cannot access non-public member A::privC
183+
Cannot access non-public member A::$privC
184184
--- (Reflecting on B::pubC) ---
185185
object(ReflectionProperty)#%d (2) {
186186
["name"]=>
@@ -196,15 +196,15 @@ object(ReflectionProperty)#%d (2) {
196196
["class"]=>
197197
string(1) "B"
198198
}
199-
Cannot access non-public member B::protC
199+
Cannot access non-public member B::$protC
200200
--- (Reflecting on B::privC) ---
201201
object(ReflectionProperty)#%d (2) {
202202
["name"]=>
203203
string(5) "privC"
204204
["class"]=>
205205
string(1) "B"
206206
}
207-
Cannot access non-public member B::privC
207+
Cannot access non-public member B::$privC
208208
--- (Reflecting on c::pubC) ---
209209
object(ReflectionProperty)#%d (2) {
210210
["name"]=>
@@ -230,15 +230,15 @@ object(ReflectionProperty)#%d (2) {
230230
["class"]=>
231231
string(1) "C"
232232
}
233-
Cannot access non-public member C::protC
233+
Cannot access non-public member C::$protC
234234
--- (Reflecting on C::privC) ---
235235
object(ReflectionProperty)#%d (2) {
236236
["name"]=>
237237
string(5) "privC"
238238
["class"]=>
239239
string(1) "C"
240240
}
241-
Cannot access non-public member C::privC
241+
Cannot access non-public member C::$privC
242242
--- (Reflecting on X::pubC) ---
243243
Fully qualified property name X::pubC does not specify a base class of C
244244
--- (Reflecting on X::protC) ---

ext/reflection/tests/ReflectionProperty_getValue_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Static property / wrong type of arg:
7575
string(15) "static property"
7676

7777
Protected property:
78-
Cannot access non-public member TestClass::prot
78+
Cannot access non-public member TestClass::$prot
7979

8080
Invalid instance:
8181

ext/reflection/tests/ReflectionProperty_setAccessible.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ var_dump($protectedStatic->getValue());
116116
var_dump($private->getValue($b));
117117
?>
118118
--EXPECT--
119-
string(44) "Cannot access non-public member A::protected"
120-
string(50) "Cannot access non-public member A::protectedStatic"
121-
string(42) "Cannot access non-public member A::private"
122-
string(48) "Cannot access non-public member A::privateStatic"
119+
string(45) "Cannot access non-public member A::$protected"
120+
string(51) "Cannot access non-public member A::$protectedStatic"
121+
string(43) "Cannot access non-public member A::$private"
122+
string(49) "Cannot access non-public member A::$privateStatic"
123123
string(1) "a"
124124
string(1) "b"
125125
string(1) "c"
@@ -128,9 +128,9 @@ string(1) "e"
128128
string(1) "f"
129129
string(1) "g"
130130
string(1) "h"
131-
string(44) "Cannot access non-public member B::protected"
132-
string(50) "Cannot access non-public member B::protectedStatic"
133-
string(42) "Cannot access non-public member A::private"
131+
string(45) "Cannot access non-public member B::$protected"
132+
string(51) "Cannot access non-public member B::$protectedStatic"
133+
string(43) "Cannot access non-public member A::$private"
134134
string(1) "a"
135135
string(1) "f"
136136
string(1) "c"

ext/reflection/tests/ReflectionProperty_setValue_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ NULL
9393
string(17) "Another new value"
9494

9595
Protected property:
96-
Cannot access non-public member TestClass::prot
96+
Cannot access non-public member TestClass::$prot
9797

9898
Instance without property:
9999
NULL

ext/reflection/tests/bug37816.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ catch (Exception $e)
2424
?>
2525
===DONE===
2626
--EXPECT--
27-
Caught: Cannot access non-public member TestClass::p
27+
Caught: Cannot access non-public member TestClass::$p
2828
===DONE===

0 commit comments

Comments
 (0)