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.
Follow up on #978676: PHP strict warning in ctools_content_render
Comment | File | Size | Author |
---|---|---|---|
#13 | panels-typo-1079792-13.patch | 937 bytes | jweowu |
#7 | panels-dont-skip-caching-of-empty-content-1079792-7.patch | 2.04 KB | das-peter |
#6 | allow_caching_empty_panes-1079792-6.patch | 914 bytes | jweowu |
fix-empty-content-1.patch | 789 bytes | amitaibu | |
Comments
Comment #1
amitaibuCorrect status
Comment #2
amitaibuThis patch is still needed ;)
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedI like this more than the (object) cast being used in an earlier patch, so committed.
Comment #5
jweowu CreditAttribution: jweowu commentedThis patch has introduced a couple of undesirable side-effects:
1) the empty content for these panes (which may potentially have been expensive to generate) is not cached.
2) modules do not have any opportunity to manipulate the content with hook_panels_pane_content_alter.
The object cast approach did not cause these problems.
git revert 2e6370ce36b82e3019a7dd73e65eb6b09deecc08
?Comment #6
jweowu CreditAttribution: jweowu commentedUploading the revert patch so that I can reference it.
Comment #7
das-peter CreditAttribution: das-peter commentedHere's a slightly updated patch:
FALSE
ctools_content_render()
.ctools_content_render()
returns nothing or an object. (At least as far as I understand the code)Comment #8
japerryLooks and tests good. Fixed!
http://drupalcode.org/project/panels.git/commit/692ad30
Comment #9
japerryComment #10
jweowu CreditAttribution: jweowu commentedThe object casting originated in #1241064: In panels_renderer_standard::render_pane_content(), the return value of ctools_content_render() should be cast to an object. (commit 8b9c1ce39d9358be2a62356a0e98ea4c791c7869 )
Are we causing a regression here?
Unrelatedly, the comment "Pass long the css_id" seen in this patch makes no sense. I imagine it was supposed to be "pass along..." ?
Comment #11
das-peter CreditAttribution: das-peter commentedI don't think so because the issue described there related to the "css configuration code". And the patch from #7 encapsulates that part as a whole into a condition that checks if
$content
is not empty.Thus the code that caused the other issue won't be executed if there's no object.
For concerns about returning content that isn't empty and isn't an object I just can say that
ctools_content_render()
deals with an object too. So we would hit an issue there beforepanels_renderer_standard::render_pane_content()
is executed.Comment #12
jweowu CreditAttribution: jweowu commentedRight, I think I concur with that.
panels_renderer_standard::render_pane_content()
is only called bypanels_renderer_standard::render_pane()
which is diligent in not making assumptions about the return value.The only pitfall I can see is that the implementations of
hook_panels_pane_content_alter
I can see (there are a couple in my current codebase) are assuming that$content
is an object. However they're also assuming it's an object with acontent
property, and casting NULL to an object isn't going to magically add one of those, so I think it's entirely reasonable to call those bugs in the implementations and expect them to verify their assumptions!Call this a post-commit RTBC :)
Comment #13
jweowu CreditAttribution: jweowu commentedA patch for that typo I noticed.
Comment #14
maximpodorov CreditAttribution: maximpodorov commentedEvery module implementing hook_panels_pane_content_alter() must be ready that $content can be NULL, right?
Comment #15
jweowu CreditAttribution: jweowu commentedmaximpodorov: yes, I believe so.