- Issue created by @Anybody
- Status changed to Needs review
over 1 year ago 11:04am 29 June 2023 - π©πͺGermany Anybody Porta Westfalica
Here we go. This resolves the issue by adding a !empty() check.
- π«π·France Chris64 France
Well, in fact even if right the new code seems difficult to understand. Since if the column is empty then
!empty
isTRUE
. And not clear for me what should be done if there is no information. For that point, may be let the next part to decide. That is!empty
should returnTRUE
if there is no information, but it returnsFALSE
, since
A variable is considered empty if it does not exist or if its value equals false.
If the column is empty, then
$options['info'][$field]['empty_column']
isTRUE
, thenempty($options['info'][$field]['empty_column'])
isFALSE
, then!empty
isTRUE
as expected. Ok, but difficult.
In that conditions, what about this change?,
$options['info'][$field]['empty_column']
->
($options['info'][$field]['empty_column'] ?? TRUE)
If the information exists the existing information is returned, if not, the returned value is easily fixed.A second point. The information $options comes from,
$options = $view->style_plugin->options;
The issue tells the information does not exist. Is it normal? Or is there a problem with the view, or some thing between? - π«π·France Chris64 France
@Anybody, may be a title shorter, would you like?
- First commit to issue fork.
- πΊπΈUnited States NicholasS
The warning is about the $field key not being in the info array, so this change keeps the old logic, but remove the PHP warning since it won't try to access ['empty_column'] for a key that does not exist in the ['info'] array.
- Status changed to Needs work
about 1 year ago 8:24pm 10 November 2023 - π©πͺGermany Anybody Porta Westfalica
@NicholasS your change is not wrong, but just obsolete. It just complicates the if clause with the same result:
!empty($options['info'][$field]) && $options['info'][$field]['empty_column']
is always the same!See #4.
So that change should please be reverted. If the proposed MR works, we should take it as it was in the beginning. If you understand what
empty()
does, it's quite clear and always a clear boolean result! - Status changed to RTBC
about 1 year ago 8:36pm 10 November 2023 - π©πͺGermany Anybody Porta Westfalica
Thought about it again and for safety reasons let's do it as proposed. Thanks all!
-
diqidoq β
committed 79ac45a2 on 2.x authored by
Anybody β
Issue #3371302 by Anybody, NicholasS, Chris64: Warning Undefined array...
-
diqidoq β
committed 79ac45a2 on 2.x authored by
Anybody β
- Status changed to Fixed
11 months ago 3:17pm 17 January 2024 - π«π·France dqd London | N.Y.C | Paris | Hamburg | Berlin
Thanks for all the work on this! comitted to latest dev 2.x
+1 @Anybody, NicholasS, Chris64
Automatically closed - issue fixed for 2 weeks with no activity.