- ๐บ๐ธUnited States greenskin
Confirmed, we too get this error. Also seeing it in 6.x.
- ๐บ๐ธUnited States greenskin
Note am seeing this when using an exposed taxonomy field with "Show hierarchy in dropdown" enabled. When this hierarchy setting is disabled I'm not seeing the error.
- Status changed to Needs review
almost 2 years ago 7:00pm 21 March 2023 - ๐บ๐ธUnited States greenskin
The issue seems to stem from relying on the existence of the delimiter to determine current level while also not requiring the filter which includes a "- All -" option (code recognizes this as a level 1 when it should be 0 because of starting with "-"). Patch sets the current level to 0 when the key is "All".
- last update
over 1 year ago 37 pass - last update
over 1 year ago Composer error. Unable to continue. - last update
over 1 year ago 37 pass - ๐ฎ๐ณIndia pragna
I have applied patch but getting same issue event if I used latest version 6.0.3.
- ๐บ๐ธUnited States esteinborn Albany, NY
Experiencing this issue in 6.0.3.
Specifically with "show hierarchy" checked. And it doesnt matter what I use as the "All" text, even if i use it without dashes, it still throws this error, and even ignores my "All" text replacement...
@pragna did you apply the patch AND make that additional change? or only your change?
Would you be able to roll a patch with your changes so we can RTBC?
Thanks!
- First commit to issue fork.
- ๐ฎ๐ณIndia keshavv India
The solution given in #10 works for me. I have created the patch for the same.
Thank you. - ๐บ๐ธUnited States esteinborn Albany, NY
When I run $key instead of $prev_key, it appends a hyphen to ALL my taxonomy terms in the list. the original patch is the only one that works for me.
- ๐บ๐ธUnited States esteinborn Albany, NY
writing back here to say the initial patch #9, not the second one does resolve the issue for me in D10 on latest version of BEF 6.0.3.
can someone else test this so we can RTBC?
- Status changed to Postponed: needs info
9 months ago 8:09pm 10 April 2024 - ๐บ๐ธUnited States smustgrave
Not able to replicate in 6.0.x are we still seeing this?
- Status changed to Closed: outdated
8 months ago 2:28pm 19 April 2024 - Status changed to Active
5 months ago 8:53pm 23 July 2024 - ๐บ๐ธUnited States karenann
+ Drupal core 10.3.1
+ Better Exposed Filters 6.0.6
+ PHP 8.2.21I have a nested taxonomy.
Patch 9 did not help. Patch 13 did, so I looked into why.I am getting the error on 202 of src/BetterExposedFiltersHelper.php in Better Exposed Filters 6.0.6
200 // If we are going down a level, keep track of its parent value. 201 if ($cur_level > $level) { 202 $parent[$cur_level] = $flat_options[$prev_key]; 203 }
Warning: Undefined array key "" in Drupal\better_exposed_filters\BetterExposedFiltersHelper::sortNestedOptions() (line 202 of modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php).
I see on line 188, before the iteration, prev_key is set to NULL:
$prev_key = NULL;
I also see on line 213, which is within each iteration, that prev_key is set to key:
$prev_key = $key;
I'm guessing, though I haven't confirmed, that with $prev_key set to NULL, the first iteration of foreach ($flat_options as $key => &$choice) { } is failing when we try to set $parent[$cur_level] to equal $flat_options[$prev_key] because that equates to setting it to $flat_options[NULL];
I'm going to tool around with this and will report back.
- ๐บ๐ธUnited States karenann
The following edit seems to help. Basically just does a null test. Would love a set of eyes before I roll a patch to submit. It doesn't do an isset to ensure $flat_options[$prev_key] actually exists, but I feel like that's not necessary.
diff --git a/web/modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php b/web/modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php index 513952c90..934b1e4ae 100644 --- a/web/modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php +++ b/web/modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php @@ -199,7 +199,7 @@ public static function sortNestedOptions(array $options, $delimiter = '-') { // If we are going down a level, keep track of its parent value. if ($cur_level > $level) { - $parent[$cur_level] = $flat_options[$prev_key]; + $parent[$cur_level] = ($prev_key ? $flat_options[$prev_key] : $prev_key); } // Prepend each option value with its parent for easier sorting.
- Status changed to Needs review
5 months ago 5:14pm 24 July 2024 - Status changed to Needs work
5 months ago 5:44pm 24 July 2024 - ๐บ๐ธUnited States smustgrave
Please open an MR and check if an issue against 7.0.x
- Status changed to Postponed: needs info
4 months ago 11:17pm 25 August 2024 - ๐บ๐ธUnited States smustgrave
Can this be confirmed against 7.0.x please
I'm still seeing this on 7.0.1 with the error
Warning: Undefined array key "" in Drupal\better_exposed_filters\BetterExposedFiltersHelper::sortNestedOptions() (line 202 of modules/contrib/better_exposed_filters/src/BetterExposedFiltersHelper.php).
- ๐บ๐ธUnited States smustgrave
Following up for steps to reproduce else going to close this one out.
- Status changed to Closed: outdated
about 1 month ago 3:57pm 7 November 2024