This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component
Jérôme Vieilledent 8b8feff246 [PropertyAccess] Fix setting public property on a class having a magic getter
| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

When using PropertyAccessor with an object having both a public property
and a magic getter, and one wants to update this property,
PropertyAccessor may lose the property reference.
This occurs when the public property value is a hash:

```php
class Foo
{
    /**
     * Example: $this->someProperty['foo']['bar'] = 'baz'
     * @var array
     */
    public $someProperty;

    public function __get($name)
    {
        // ...
    }
}

$obj = new Foo();
$obj->someProperty = ['foo' => ['bar' => 'some_value']];

$propertyAccessor->setValue($obj, 'someProperty[foo][bar]', 'another_value');

echo $obj->someProperty['foo']['bar'];
// Before this patch: 'some_value' => fail
// After this patch: 'another_value' => correct
```

Furthermore, public properties are always used before `__get()` by PHP.

This bug is visible since v2.6.5 as d733a887 changed the way
`setValue()` works.
2015-05-11 17:09:39 +02:00
..
BrowserKit Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
ClassLoader Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Config Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Console Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
CssSelector Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Debug [Debug] Fixed ClassNotFoundFatalErrorHandlerTest 2015-05-08 15:17:44 +02:00
DependencyInjection Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
DomCrawler Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
EventDispatcher Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
ExpressionLanguage [2.6] link to https://symfony.com where possible 2015-05-01 16:14:24 +02:00
Filesystem Merge branch '2.3' into 2.6 2015-05-08 02:09:07 +02:00
Finder Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Form Fix getOrigin 2015-05-04 11:39:13 +02:00
HttpFoundation Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
HttpKernel bumped Symfony version to 2.6.8 2015-05-11 04:25:53 +02:00
Intl Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Locale Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
OptionsResolver Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Process Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
PropertyAccess [PropertyAccess] Fix setting public property on a class having a magic getter 2015-05-11 17:09:39 +02:00
Routing Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Security Merge branch '2.3' into 2.6 2015-05-11 03:52:28 +02:00
Serializer Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Stopwatch Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Templating Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00
Translation minor #14549 [Translation] simplify getMessages. (aitboudad) 2015-05-05 16:51:00 +00:00
Validator [Validator] Property paths starting with 0 are broken. 2015-05-05 03:29:27 +02:00
VarDumper [2.6] link to https://symfony.com where possible 2015-05-01 16:14:24 +02:00
Yaml Merge branch '2.3' into 2.6 2015-05-02 17:18:45 +02:00