Commit c49d6db
committed
bug symfony#58226 [Serializer] Fix for method named
This PR was squashed before being merged into the 6.4 branch.
Discussion
----------
[Serializer] Fix for method named `get()`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix symfony#58012
| License | MIT
During normalization, if a class has a method called `get` that method will get confused for an accessor and it will go through logic relating to property-access for the property named `substr('get', 3)`.
Eventually a new PropertyPath instance will be created with an empty path which will trigger an exception.
```php
$serializer->serialize(new class {
public function get() {}
}, 'json');
```
Commits
-------
a0d6e26 [Serializer] Fix for method named `get()`get() (mihai-stancu)File tree
1 file changed
+7
-2
lines changed- src/Symfony/Component/Serializer/Normalizer
1 file changed
+7
-2
lines changedLines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
110 | | - | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| |||
0 commit comments