Closed fritzmg closed 3 years ago
@fritzmg pls check Travis
Unfortunately I don't really see what the actual error is. May be someone can point it out to me what needs to be changed?
- $objWidget = $this->initializeWidget($arrField, $i, $strKey, $this->varValue[$i][$strKey] ?? null);
+ $objWidget = $this->initializeWidget($arrField, $i, $strKey, ($this->varValue[$i][$strKey] ?? null));
say Xtra :D
Sadly you got bitten by https://github.com/squizlabs/PHP_CodeSniffer/issues/2325, there is unfortunately nothing we can do here, aside from adding the brackets (even if they seem to be a little over expressive).
@discordier Why should we do anything about it? I think this is good
Why would you want to have these brackets?
In any case, I think the root cause of this error is may be somewhere else entirely. Under some circumstances MCW saves invalid data into its widget's database field and then that's when this illegal array access occurs. Unfortunately I haven't found a clear reproduction yet.
what kind of "invalid data"?
In our case the database just contained the string 0
, instead of a serialized array.
If you have configured the default value and not all column fields are available. This is then such a case study
Which case do you mean? The illegal array access for this PR? But why would only specific column fields not be available? Either all or none should be there usually.
$GLOBALS['TL_DCA']['table']['fields']['multi'] = [
'inputType' => 'multiColumnWizard',
'default' => [
0 => [
'foo' => 'fooValue'
]
],
'eval' => [
'columnFields' => [
'foo' => [
'inputType' => 'text'
],
'bar' => [
'inputType' => 'text'
]
]
]
];
In this example, the default differs from the fields.
Ah ok, yeah but this is not the case for the fields where this problem occurred. No default has been defined there.
PR is merges in the new hotfix/3.4.11. Please test it and let me know if this works @fritzmg. Corrections for travis are done.
I made a quick test and it should be fine :)
Fixes an illegal array access that can occur in
MultiColumnWizard::generate
: