Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Create a view with one required and one optional argument, enable pager and ajax. Try to click on next page. Nothing will happen, network tab for the request should display a fatal error.
Proposed resolution
Two problems. The fatal error is because $preview is not checked for being empty, so we should make that conditional to avoid the fatal errors.
Second, we need to somehow filter out the empty arguments and replace them with NULL, then views argument handling is happy again.
Remaining tasks
Write tests.
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#8 | views-ajax-args-2358603-8-interdiff.txt | 763 bytes | Berdir |
#8 | views-ajax-args-2358603-8.patch | 2.72 KB | Berdir |
#5 | views-ajax-args-2358603-5-interdiff.txt | 1.93 KB | Berdir |
#5 | views-ajax-args-2358603-5.patch | 2.65 KB | Berdir |
#5 | views-ajax-args-2358603-5-test-only.patch | 1.23 KB | Berdir |
Comments
Comment #1
BerdirHere is a patch
Comment #2
jibranCan we add some tests here?
Comment #3
dawehnerEven we do have a pure unit test for that class already, we should also have a proper integration test here as well.
Comment #4
BerdirI tried to extend the unit tests, but that is apparently not possible because PHPUnit_Framework_MockObject_Matcher_Parameters hardcodes an isEqual constraint, which doesn't care about NULL/empty string.
The mocking of drupalRender() somehow also prevents the recoverable fatal errors that you get when you pass NULL/FALSE to the real method.
Comment #5
BerdirOk, figured it out. Also noticed that my fix was bogus, not sure how that worked for me ;)
Not sure about integration tests then, is there already something we can extend for ajax pagers?
Comment #7
dawehnerNote: it would be kinda explain why we do things here, not what.
Comment #8
BerdirBetter?
Anything else? :)
Comment #9
dawehnerAlright, thank you sir!
Comment #11
catchCommitted/pushed to 8.0.x, thanks!