Closed
Description
Hi guys!
Code to reproduce:
use Symfony\Component\PropertyAccess\PropertyAccess;
$data = new stdClass();
$data->pizzas = array(
'mushroom'
);
$accessor = PropertyAccess::createPropertyAccessor();
$val = $accessor->getValue($data, 'pizzas[1]');
dump($data);
This will print:
{
+"pizzas": array:2 [
0 => "mushroom"
1 => null
]
}
Notice the 1 key has actually been added to the underlying data. The problem seems to only happen when you're working on an array inside of an object (i.e. I could not reproduce this by working with an array at the top-level).