@@ -95,7 +95,7 @@ public function getValue(object|array $objectOrArray, string|PropertyPathInterfa
9595 self ::VALUE => $ objectOrArray ,
9696 ];
9797
98- if (\is_object ($ objectOrArray ) && false === strpbrk ((string ) $ propertyPath , '.[? ' )) {
98+ if (\is_object ($ objectOrArray ) && false === strpbrk ((string ) $ propertyPath , '.[? ' ) || $ objectOrArray instanceof \stdClass && property_exists ( $ objectOrArray , $ propertyPath )) ) {
9999 return $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty )[self ::VALUE ];
100100 }
101101
@@ -111,7 +111,7 @@ public function getValue(object|array $objectOrArray, string|PropertyPathInterfa
111111 */
112112 public function setValue (object |array &$ objectOrArray , string |PropertyPathInterface $ propertyPath , mixed $ value )
113113 {
114- if (\is_object ($ objectOrArray ) && false === strpbrk ((string ) $ propertyPath , '.[ ' )) {
114+ if (\is_object ($ objectOrArray ) && ( false === strpbrk ((string ) $ propertyPath , '.[ ' ) || $ objectOrArray instanceof \stdClass && property_exists ( $ objectOrArray , $ propertyPath ) )) {
115115 $ zval = [
116116 self ::VALUE => $ objectOrArray ,
117117 ];
@@ -214,7 +214,13 @@ public function isReadable(object|array $objectOrArray, string|PropertyPathInter
214214 $ zval = [
215215 self ::VALUE => $ objectOrArray ,
216216 ];
217- $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength (), $ this ->ignoreInvalidIndices );
217+
218+ // handle stdClass with properties with a dot in the name
219+ if ($ objectOrArray instanceof \stdClass && str_contains ($ propertyPath , '. ' ) && property_exists ($ objectOrArray , $ propertyPath )) {
220+ $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty );
221+ } else {
222+ $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength (), $ this ->ignoreInvalidIndices );
223+ }
218224
219225 return true ;
220226 } catch (AccessException ) {
@@ -232,6 +238,14 @@ public function isWritable(object|array $objectOrArray, string|PropertyPathInter
232238 $ zval = [
233239 self ::VALUE => $ objectOrArray ,
234240 ];
241+
242+ // handle stdClass with properties with a dot in the name
243+ if ($ objectOrArray instanceof \stdClass && str_contains ($ propertyPath , '. ' ) && property_exists ($ objectOrArray , $ propertyPath )) {
244+ $ this ->readProperty ($ zval , $ propertyPath , $ this ->ignoreInvalidProperty );
245+
246+ return true ;
247+ }
248+
235249 $ propertyValues = $ this ->readPropertiesUntil ($ zval , $ propertyPath , $ propertyPath ->getLength () - 1 );
236250
237251 for ($ i = \count ($ propertyValues ) - 1 ; 0 <= $ i ; --$ i ) {
0 commit comments