@@ -150,7 +150,7 @@ public function getValue($objectOrArray, $propertyPath)
150
150
self ::VALUE => $ objectOrArray ,
151
151
];
152
152
153
- if (\is_object ($ objectOrArray ) && false === strpbrk ((string ) $ propertyPath , '.[ ' )) {
153
+ if (\is_object ($ objectOrArray ) && ( false === strpbrk ((string ) $ propertyPath , '.[ ' ) || $ objectOrArray instanceof \stdClass && property_exists ( $ objectOrArray , $ propertyPath ) )) {
154
154
return $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty )[self ::VALUE ];
155
155
}
156
156
@@ -166,7 +166,7 @@ public function getValue($objectOrArray, $propertyPath)
166
166
*/
167
167
public function setValue (&$ objectOrArray , $ propertyPath , $ value )
168
168
{
169
- if (\is_object ($ objectOrArray ) && false === strpbrk ((string ) $ propertyPath , '.[ ' )) {
169
+ if (\is_object ($ objectOrArray ) && ( false === strpbrk ((string ) $ propertyPath , '.[ ' ) || $ objectOrArray instanceof \stdClass && property_exists ( $ objectOrArray , $ propertyPath ) )) {
170
170
$ zval = [
171
171
self ::VALUE => $ objectOrArray ,
172
172
];
@@ -293,7 +293,13 @@ public function isReadable($objectOrArray, $propertyPath)
293
293
$ zval = [
294
294
self ::VALUE => $ objectOrArray ,
295
295
];
296
- $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength (), $ this ->ignoreInvalidIndices );
296
+
297
+ // handle stdClass with properties with a dot in the name
298
+ if ($ objectOrArray instanceof \stdClass && str_contains ($ propertyPath , '. ' ) && property_exists ($ objectOrArray , $ propertyPath )) {
299
+ $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty );
300
+ } else {
301
+ $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength (), $ this ->ignoreInvalidIndices );
302
+ }
297
303
298
304
return true ;
299
305
} catch (AccessException $ e ) {
@@ -314,6 +320,14 @@ public function isWritable($objectOrArray, $propertyPath)
314
320
$ zval = [
315
321
self ::VALUE => $ objectOrArray ,
316
322
];
323
+
324
+ // handle stdClass with properties with a dot in the name
325
+ if ($ objectOrArray instanceof \stdClass && str_contains ($ propertyPath , '. ' ) && property_exists ($ objectOrArray , $ propertyPath )) {
326
+ $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty );
327
+
328
+ return true ;
329
+ }
330
+
317
331
$ propertyValues = $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength () - 1 );
318
332
319
333
for ($ i = \count ($ propertyValues ) - 1 ; 0 <= $ i ; --$ i ) {
0 commit comments