You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException: Can't get a way to read the property "bankAccount" in class "stdClass". in /sites/property-access/vendor/symfony/property-access/PropertyAccessor.php on line 442
Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException: Can't get a way to read the property "bankAccount" in class "stdClass". in /sites/property-access/vendor/symfony/property-access/PropertyAccessor.php on line 442
…lexandre-daubois)
This PR was merged into the 5.4 branch.
Discussion
----------
[PropertyAccess] Fix handling property names with a `.`
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#58100
| License | MIT
If the property path contains a dot, it is considered to be an access to an underlying property. However, some edge cases allow to have dots in property names, especially with `stdClass`.
Minimal reproducer:
```php
$stdclass = (object) ['bankAccount.iban' => 'NL16TEST0436169118', 'bankSummary' => ''];
$accessor = PropertyAccess::createPropertyAccessor();
dump($accessor->getValue($stdclass, 'bankAccount.iban')); // returns "NL16TEST0436169118"
$accessor->setValue($stdclass, 'bankAccount.iban', 'value');
dump($accessor->getValue($stdclass, 'bankAccount.iban')); // returns "value"
```
Commits
-------
d939a16 [PropertyAccess] Fix handling property names with a `.`
Symfony version(s) affected
6.4.8 and 7.1.1
Description
When serializing an object which has properties with a dot in the name, a NoSuchPropertyException is thrown.
How to reproduce
Run this on PHP 8.3
composer.json for 6.4.8
composer.json for 7.1.1
test.php
Possible Solution
No response
Additional Context
The text was updated successfully, but these errors were encountered: