Commit c210fab
committed
bug symfony#58110 [PropertyAccess] Fix handling property names with a
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 symfony#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 `.`. (alexandre-daubois)File tree
2 files changed
+18
-3
lines changed- src/Symfony/Component/PropertyAccess
- Tests
2 files changed
+18
-3
lines changedLines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
297 | 303 | | |
298 | 304 | | |
299 | 305 | | |
| |||
314 | 320 | | |
315 | 321 | | |
316 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
317 | 331 | | |
318 | 332 | | |
319 | 333 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| 677 | + | |
677 | 678 | | |
678 | 679 | | |
679 | 680 | | |
| |||
0 commit comments