@@ -150,7 +150,7 @@ public function getValue($objectOrArray, $propertyPath)
150150 self ::VALUE => $ objectOrArray ,
151151 ];
152152
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 ) )) {
154154 return $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty )[self ::VALUE ];
155155 }
156156
@@ -166,7 +166,7 @@ public function getValue($objectOrArray, $propertyPath)
166166 */
167167 public function setValue (&$ objectOrArray , $ propertyPath , $ value )
168168 {
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 ) )) {
170170 $ zval = [
171171 self ::VALUE => $ objectOrArray ,
172172 ];
@@ -293,7 +293,13 @@ public function isReadable($objectOrArray, $propertyPath)
293293 $ zval = [
294294 self ::VALUE => $ objectOrArray ,
295295 ];
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+ }
297303
298304 return true ;
299305 } catch (AccessException $ e ) {
@@ -314,6 +320,14 @@ public function isWritable($objectOrArray, $propertyPath)
314320 $ zval = [
315321 self ::VALUE => $ objectOrArray ,
316322 ];
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+
317331 $ propertyValues = $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength () - 1 );
318332
319333 for ($ i = \count ($ propertyValues ) - 1 ; 0 <= $ i ; --$ i ) {
0 commit comments