Note: this seems to be specific to PHP 5.6.
Steps to reproduce:
- Create a new content view with aggregation enabled and save it.
- Add a new display and don't save the view.
- Try to add a field to the new display.
During step 3, after selecting the "Aggregation type" and clicking "Apply and continue", an AJAX error will be displayed stating:
Fatal error: [] operator not supported for strings in modules/views/includes/admin.inc on line 2399
Watchdog also records a bunch of PHP warnings and notices starting with:
Warning: Parameter 3 to views_ui_build_form_state() expected to be a reference, value given in views_ui_ajax_form() (line 2949 of modules/views/includes/admin.inc
The problem therefore seems to stem from the call_user_func_array() on line 2949 not passing the $view object by reference to views_ui_build_form_state(). This only seems to be a problem with PHP 5.6; it works fine on 5.5 and 5.4.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | views-ajax_fatal_error_[]_operator_not_support-2767167-18.patch | 2.76 KB | andrew answer |
| #15 | views-n2767167-15.patch | 729 bytes | valderama |
| #12 | views-n2767167-12.patch | 2.76 KB | jenlampton |
| #9 | views-n2767167-9.patch | 2.76 KB | damienmckenna |
Comments
Comment #2
torgospizzaRan into this too. What's the best way to fix? Is it simple enough to pass the variable as a reference instead?
Comment #3
g33kg1rl commentedI receive this error when trying add a new taxonomy filter on a view with aggregation. Any ideas?
Comment #4
spgd01 commentedI have exact same issue as #3
Comment #5
skaughtissue also occurs in php7
in my case we were adding a term reference field.
only had
Fatal error: [] operator not supported for strings in modules/views/includes/admin.inc on line 2399Comment #6
skaughtIMO: major. this stops anyone from being able to build a View.
short term work around: turn of javascript on your browser and build your view.
Comment #7
nickonom commentedEven-though #2823977: Ajax http 500 error using taxonomy to filter view was filed later than this one, it has already working patch for the same problem, so I am marking this as duplicate.
Comment #8
richardp commentedThough this is closed, I still found this issue when going through google. I saw the first error, about how you can't use [] operand on string, after updating to PHP7.0.
The other patch mentioned in comment #7 didn't work for me.
I made my own edits to views/include/admin.inc. Starting on line 2391, this is the entire views_ui_regenerate_tab function, including my change:
Comment #9
damienmckennaOk, lets try this then.
Comment #10
damienmckennaComment #11
vdupom commentedAt line 2497 is_array() is missing the parameter, I believe it should be
if (!is_array($output)) {Now adding a field does nothing in the Views UI and an error is logged:
Warning: is_array() expects exactly 1 parameter, 0 given in views_ui_regenerate_tab() (line 2497 of ..../sites/all/modules/contrib/views/includes/admin.inc).Comment #12
jenlamptonHere's an updated patch that contains the recommended fix from #11.
I've also filed a similar issue against Backdrop core:
https://github.com/backdrop/backdrop-issues/issues/3244
Comment #13
g33kg1rl commentedPatch #12 fixed the issue on my websites. :)
Comment #14
chris matthews commentedThe patch in #12 to admin.inc does not apply to the latest views 7.x-3.x-dev.
Comment #15
valderama commentedA patch with just the meat, and no typo fixes in the comments.
Comment #16
skaughtComment #18
andrew answer commentedPatch rerolled.
Comment #19
dylf commented$outputvariable is a string.$outputis expected to be an array of ajax commands. This doesn't seem like a proper solution.