Problem/Motivation
Moving to PHP 7.4 we noticed these warnings:
Warning: Creating default object from empty value in views_handler_filter_selective->get_oids() (line 320 of views_selective_filters/views_handler_filter_selective.inc).
Warning: Creating default object from empty value in views_handler_filter_selective->get_oids() (line 321 of views_selective_filters/views_handler_filter_selective.inc).
Proposed resolution
Initialize the display on the cloned view to create the object that is attempting to be set.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3152283-4-warning-object-from-empty-value-php-7.4.patch | 860 bytes | joelpittet |
Comments
Comment #2
joelpittetHere's the patch for review
Comment #3
jplana commentedI can confirm this patch #2 worked for me.
Comment #4
joelpittetUnfortunately @jplana and I ran into an issue with my patch, it seems to squash the error but has some side-effects where it spits out multiple of the same value.
I still think it's correct to initialize the handler instead of just building a fake stdClass object to squash the error.
Here's another patch that seems to not have the side effects of initializing all the displays.
I pulled out the original issue that introduced the lines and there was a set_display() in the patch but removed on commit #2633548: Attached displays should not be executed in dummy view
But the set_display() causes the same bug duplicating the options. (at a glance it's multiplying the options by the number of displays). So this patch just initiates the current display's display handler... manually.
Comment #5
joelpittetThanks @jplana, I've committed this to the dev release.
Comment #8
donquixote commentedThe fix is a bit strange. Why do we assign an object by reference?