- Issue created by @ovidenov
- Status changed to Postponed: needs info
over 1 year ago 9:58am 28 February 2023 - ๐ณ๐ฟNew Zealand quietone
I happen to be testing with Views right now and saw this issue. I tried to reproduce this on Drupal 10.1.x, umami install and, so far, have not been able to.
Can you elaborate on what you did to "set the aggregation to some value"? Thanks.
- ๐ณ๐ฑNetherlands Rop Rotterdam
I get a simular error:
TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (regel 687 van /var/www/[site]/web/core/modules/views/src/Plugin/views/field/EntityField.php)
I can save the view though. The error occurs when trying to change the aggregation function on one of my fields from COUNT to anything else. The modal won't close.
Drupal: 9.5.8
Php:8.1.18I guess the provided patch #2 is not really a solution, since the provided value SHOULD be an array, so the question is why is it NULL instead? The problem is something other, so If we just skip handling it when it is not an array we are only hiding an error, not fixing it.
- ๐บ๐ธUnited States mkindred
I ran across this issue today. I was trying to create a simple admin report showing the number of images (media) attached to each node of a particular content type. (I need to limit the number of images that my client adds to an existing 'product' content type, but first we need a report showing how many he's currently using per product.)
Here are the steps I took (in D9.5.10):
- Create a view for a single content type, table list of fields.
- Add a relationship to each of two media fields (images in my case).
- Add two image fields to the view, each using one of the two relationships above.
- Turn on aggregation. The aggregation works as expected, except that the two fields' counts are multiplied by each other.
- I tried to change the aggregation type for the two image fields from 'Count' to 'Count DISTINCT'. But the modal won't close, and I'm seeing an error in watchdog:
TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 687 of /var/www/html/drupal/web/core/modules/views/src/Plugin/views/field/EntityField.php)
As mentioned in #4, I'm not sure patch #2 is the correct solution, but it prevents the error, allows me to save the aggregation settings per field, and gives me the view I want.
- Status changed to Needs work
about 1 year ago 6:44am 12 September 2023 - ๐ณ๐ฑNetherlands Lendude Amsterdam
Closed ๐ Aggregation in views causes ajax error Closed: duplicate as a duplicate, very similar patch there.
Thanks for the steps to reproduce, we will need an automated test for this too.
- ๐ต๐ฑPoland besek
I had the same issues, with very similar steps to reproduce as described in #5 ๐ Ajax error on views with aggregation Postponed: needs info .
Patch from #2 ๐ Ajax error on views with aggregation Postponed: needs info wroked well for me. - ๐ฎ๐นItaly Turneight
I report the patch proposed in the discussion closed because it was duplicated
- last update
about 1 year ago 30,142 pass, 2 fail - last update
about 1 year ago 29,477 pass - last update
about 1 year ago 29,477 pass - last update
about 1 year ago 30,377 pass - ๐ซ๐ทFrance xavier.masson Haute-Normandie
Thanks for the patch, the patch from #8 ๐ Ajax error on views with aggregation Postponed: needs info works as expected on Drupal core 9.5.11 !
- last update
12 months ago 30,667 pass - last update
12 months ago 30,667 pass - ๐บ๐ธUnited States crutch
Patch doesn't apply to 10.1.8
When manually changing /core/modules/views/src/Plugin/views/field/EntityField.php and not changing /core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php then the error is gone and works normally again.
- ๐ซ๐ทFrance dqd London | N.Y.C | Paris | Hamburg | Berlin
@#8 this hasn' addressed #6 yet. This issue needs a reroll of #2 or #8 with the points made in #6.
- last update
10 months ago 25,805 pass, 1,851 fail - ๐ฎ๐นItaly Turneight
- ๐ซ๐ทFrance dqd London | N.Y.C | Paris | Hamburg | Berlin
@Turneight: Thanks for coming back on this! +1
- Status changed to Postponed: needs info
10 months ago 3:23pm 29 January 2024 - ๐ณ๐ฑNetherlands Lendude Amsterdam
Rereading this, feels like a duplicate of ๐ Switching on aggregation generates fatal "Column not found: 1054 Unknown column" SQL error when using multi-column Fields Needs work can somebody check if the work there helps fix their issues?
- ๐บ๐ธUnited States crutch
For me, this issue was happening having a view with (1) Integer (2) Embed containing a single integer field which is aggregated and a (3) Simple Math Field to achieve a result. I simply could not modify aggregation at (2) at some point and found this issue. #14 speaks to multi-column fields which I wasn't using a display field with multi-columns, but in the (2) Embed field, there is a date filter which is related to this original issue. Aggregation is applied to filters and the display integer field at (2). I assume date is a multi-column field like image.
i have the same issue using D10.2.3, with default theme. I get this error if i try to aggregate decimal or text fields.
Here's the error I'm getting in javascript console:
[Error] Failed to load resource: the server responded with a status of 500 () (ref_pollutant_category, line 0)
[Error] AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/ajax/handler-group/recommended_ef_charts/block_2/field/ref_pollutant_category
StatusText: error
ResponseText: The website encountered an unexpected error. Try again later.TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 692 of core/modules/views/src/Plugin/views/field/EntityField.php). Drupal\views\Plugin\views\field\EntityField->submitGroupByForm(Array, Object) (Line: 106)
Drupal\views_ui\Form\Ajax\ConfigHandlerGroup->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 264)
Drupal\views_ui\ViewUI->standardSubmit(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('views_ui_config_item_group_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm('Drupal\views_ui\Form\Ajax\ConfigHandlerGroup', Object) (Line: 215)
Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 217)
Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\views_ui\Form\Ajax\ConfigHandlerGroup', Object) (Line: 127)
Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object, 'block_2', 'ajax') (Line: 38)
Drupal\views_ui\Form\Ajax\ConfigHandlerGroup->getForm(Object, 'block_2', 'ajax', 'field', 'ref_pollutant_category')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)and here's the error in the recent log:
Location: https://wfrd.ddev.site/admin/structure/views/ajax/handler-group/recommen...
Message: TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 692 of /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityField.php).
Backtrace:
#0 /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityField.php(692): array_filter(NULL)
#1 /var/www/html/web/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php(106): Drupal\views\Plugin\views\field\EntityField->submitGroupByForm(Array, Object(Drupal\Core\Form\FormState))
#2 [internal function]: Drupal\views_ui\Form\Ajax\ConfigHandlerGroup->submitForm(Array, Object(Drupal\Core\Form\FormState))
#3 /var/www/html/web/core/modules/views_ui/src/ViewUI.php(264): call_user_func_array(Array, Array)
#4 [internal function]: Drupal\views_ui\ViewUI->standardSubmit(Array, Object(Drupal\Core\Form\FormState))
#5 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(129): call_user_func_array(Array, Array)
#6 /var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(67): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#7 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#8 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('views_ui_config...', Array, Object(Drupal\Core\Form\FormState))
#9 /var/www/html/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(215): Drupal\Core\Form\FormBuilder->buildForm('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#10 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\views_ui\Form\Ajax\ViewsFormBase->Drupal\views_ui\Form\Ajax\{closure}()
#11 /var/www/html/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(217): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#12 /var/www/html/web/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php(127): Drupal\views_ui\Form\Ajax\ViewsFormBase->ajaxFormWrapper('Drupal\\views_ui...', Object(Drupal\Core\Form\FormState))
#13 /var/www/html/web/core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php(38): Drupal\views_ui\Form\Ajax\ViewsFormBase->getForm(Object(Drupal\views_ui\ViewUI), 'block_2', 'ajax')
#14 [internal function]: Drupal\views_ui\Form\Ajax\ConfigHandlerGroup->getForm(Object(Drupal\views_ui\ViewUI), 'block_2', 'ajax', 'field', 'ref_pollutant_c...')
#15 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#18 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#19 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#33 {main}- Status changed to Needs work
9 months ago 10:22pm 5 March 2024 - ๐ณ๐ฟNew Zealand john pitcairn
Re #14 and #15: This is not specific to multi-column fields. I can reproduce it with a single entityreference field in a view of commerce subscriptions.
I can set aggregation for the field to COUNT, and apply.
But thereafter I cannot remove or change the aggregation for the field. Clicking apply will produce the ajax error.
Un-postponing.
- ๐ซ๐ทFrance yonailo Paris
Yes #8 works for me too (I am running Drupal 10.3.0)
- ๐ฎ๐ณIndia Binoli Lalani Gujarat
binoli lalani โ made their first commit to this issueโs fork.
- ๐ฎ๐ณIndia Binoli Lalani Gujarat
binoli lalani โ changed the visibility of the branch 3344910-ajax-error-on to hidden.
- ๐ฎ๐ณIndia Binoli Lalani Gujarat
binoli lalani โ changed the visibility of the branch 3344910-ajax-error-on to active.
- Merge request !10181Issue #3344910: Ajax error on views with aggregation โ (Open) created by Binoli Lalani
- ๐ฎ๐ณIndia Binoli Lalani Gujarat