Problem/Motivation
\Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() relies on very odd PHP behaviour that is fixed in PHP 8.
This is happening because of this behaviour change in PHP 8.0 - https://3v4l.org/TJ2cb.
This change in behaviour in PHP 8 is explained with this RFC: https://wiki.php.net/rfc/string_to_number_comparison. TL;DR, PHP 8 has adopted changes to how string to integer comparisons should be handled and no longer type juggling a string to a numeric equivalent before comparison.
Steps to reproduce
if (isset($view->form_cache) && $view->form_cache['key'] != $key) {
to
if (isset($view->form_cache) && $view->form_cache['key'] !== $key) {
and run core/modules/views_ui/tests/src/Functional/FilterUITest.php
see https://dispatcher.drupalci.org/job/drupal_patches/63999/
Proposed resolution
Don't duplicate the use $key and change to !==
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#6 | 3177590-6.patch | 2.13 KB | alexpott |
#6 | 2-6-interdiff.txt | 1.85 KB | alexpott |
Comments
Comment #2
alexpottHere's a fix. This is happening because of this behaviour change in PHP 8.0 - https://3v4l.org/TJ2cb
Comment #4
longwaveWould it be better to also rename $key as $form_key?
Comment #5
andypostComment #6
alexpottRe #4 sure - why not.
Comment #7
hussainwebModified IS to explain the change in PHP 8 with more details and link to RFC.
Comment #8
hussainwebThat said, this does LGTM.
Comment #9
longwaveRTBC +1
Comment #10
tim.plunkettLate to the party, but wow that was an interesting one. Nice find, nice fix.
Comment #12
andypostBot flux
Comment #15
catchCommitted bf1dd77 and pushed to 9.2.x. Thanks!
Cherry-picked to 9.1.x too.