Make sure Views is fully compatible with PHP 8.
Comment | File | Size | Author |
---|---|---|---|
#37 | 7.diff | 2.51 KB | Taran2L |
#26 | views-n3207982-26.interdiff.txt | 885 bytes | DamienMcKenna |
#26 | views-n3207982-26.patch | 5.6 KB | DamienMcKenna |
#24 | views-n3207982-24.patch | 9.19 KB | DamienMcKenna |
#22 | views-n3207982-22.patch | 9.61 KB | DamienMcKenna |
Issue fork views-3207982
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
DamienMcKennaComment #3
DamienMcKennaI set up a testbot for PHP 8: https://www.drupal.org/pift-ci-job/2027110
Comment #4
DamienMcKennaThere are some errors noted..
I'm concerned at this one:
I'm concerned that fixing this will require an API break.
There are some simpler things, e.g.:
and:
And this one:
And:
*cough* Yeah... some of these might be hard to fix without breaking anything.
Comment #5
DamienMcKennaSome of this is already handled in #3189937: PHP 8: Required parameter after optional deprecation notice.
Comment #7
DamienMcKennaAyesh worked on views_plugin_query_default::init() in #3189937.
Comment #8
DamienMcKennaAyesh's changes.
Comment #9
DamienMcKennaComment #10
DamienMcKenna.. is going to be weird because it isn't clear which variable is causing the problem.
Comment #11
DamienMcKennaTrying to fix _views_query_tag_alter_condition().
Comment #12
DamienMcKennaThis fixes the problem in _views_query_tag_alter_condition() by converting the nested array to a JSON string and converting it back again after the str_replace().
Comment #14
DamienMcKennaI rewrote the string replacement using array_walk_recursive().
Comment #16
DamienMcKennaDoes this work?
Comment #17
DamienMcKennaOk, so at least it doesn't cause regressions.
Comment #18
DamienMcKennaTrying to fix the comment tests.
Comment #19
DamienMcKennaThere's something funny with _testMultipleFieldRender(), the "Test delta first last" part fails to render properly with PHP 8. This adds an extra assertion to make sure the output renders.
Comment #20
DamienMcKennaI've studied the data and there's a problem when "delta_first_last" is enabled on a field, for some reason the query doesn't return any data with PHP 8. I've confirmed this by disabling "delta_first_last" but leaving the other options as-is, the query returned data.
The only place that the option is used is in this code from views_handler_field_field::get_value():
Comment #22
DamienMcKennaTry again.
Comment #24
DamienMcKennaOk fine :p
Comment #26
DamienMcKennaSide-step.. attempting to fix the failures in cache handling.
Comment #27
DamienMcKennaComment #30
DamienMcKennaTo move things along I've committed #19.
Comment #31
MustangGB CreditAttribution: MustangGB commentedWhat a roller coaster.
Comment #32
DamienMcKennaThe last problems seems to be:
gather_headers
exception: [Warning] Line 203 of sites/all/modules/views/plugins/views_plugin_cache.inc:
Array to string conversion
(repeated a bunch of times)
_testMultipleFieldRender
fail: [Other] Line 442 of sites/all/modules/views/tests/field/views_fieldapi.test:
Value NULL is not NULL.
fail: [Other] Line 447 of sites/all/modules/views/tests/field/views_fieldapi.test:
Take sure that the amount of items are limited.
(repeated twice more)
Comment #33
Taran2LI've given it a bit of attention and here are my thoughts:
1. The caching issue seems like .. hm .. weird. I (almost) believe that actual code does not do anything, because in older version of PHP it just returns the
$subject
array (because our array are multidimensional). PHP8.0+ expects a one dimensional array, thus the error:2. The
_testMultipleFieldRender
issue is even trickier. I think there is an error in the test itself:The limit is 0, so yes, there are no results. The only thing that bothers me there is: how come it worked before.
Comment #34
Taran2LUpdate re #1. So, actually head part does not work at all, just because later in
views_plugin_cache::restore_headers()
the following part is incorrect:And
drupal_add_html_head()
requires both$data
and$key
to be set:Update re #2, in PHP < 8.0 the following code evaluates to
true
, see https://3v4l.org/iXBHfAlright, then #2 is a test issue :)
Comment #36
Taran2LComment #37
Taran2LComment #38
DamienMcKennaGreat work, thank you!
Comment #40
DamienMcKennaCommitted. Thanks Taran2L!