APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
492 stars 344 forks source link

Fixed notices in Grid/Column/Column #1047

Open unrealevil opened 4 years ago

unrealevil commented 4 years ago

Fixed notice: "Trying to access array offset on value of type null" in Grid/Column/Column.php on PHP 7.4

Bomere commented 4 years ago

Very usefull! I use a lot of grid in my project and our server run with PHP7.4. The notice isn't throw into production env. but it's not possible to access grid in dev env. ... It's boring.

👍 👍

DonCallisto commented 4 years ago

It seems to be good but I suspect that's "hiding" some kind of other issue that should be investigated. As $data seems to be treated always as an array, why there's a case where it has no value? Just wondering if this issue should be tackled by understanding why such null value arise.

npotier commented 4 years ago

@DonCallisto I agree with you. The source code shows that $data is not initialized in the constructor, but only in the setData method. Therefore, I guess that if you call getData before setData, the warning occurs.

To be completly safe, I guess that $data should be initialized in the constructor as it is actually done in the setData method:

$this->data = ['operator' => $this->getDefaultOperator(), 'from' => static::DEFAULT_VALUE, 'to' => static::DEFAULT_VALUE];

but I don't know if creates side effects somewhere else.

vialcollet commented 4 years ago

Any news on this? This is preventing from running php7.4. Thanks!

manuel-garcia-dkt commented 3 years ago

Any updates on this? As @vialcollet says, this is broken on dev environment for php 7.4

kaamaa commented 3 years ago

Any updates on this? As @vialcollet says, this is broken on dev environment for php 7.4

yes, you can find he required changes here:

https://github.com/kaamaa/APYDataGridBundle

manuel-garcia-dkt commented 3 years ago

Any updates on this? As @vialcollet says, this is broken on dev environment for php 7.4

yes, you can find he required changes here:

https://github.com/kaamaa/APYDataGridBundle

Thanks for repply! There is another aditional change than blocks.twig? https://github.com/kaamaa/APYDataGridBundle/commit/6128364ff7052696e4581ba007e0da920617c976

kaamaa commented 3 years ago

Thanks for repply! There is another aditional change than blocks.twig? kaamaa@6128364

Yes, it supports symphony 5.2