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.
The output of drupal_render_cache_get() is not explicitly checked for FALSE, so an element who's output is an empty string is treated as a cache miss.
Attached patch fixes.
Comment | File | Size | Author |
---|---|---|---|
#17 | cache-onlytests-1402962-17.patch | 1.42 KB | oriol_e9g |
#17 | cache-1402962-17.patch | 1.99 KB | oriol_e9g |
#14 | 1402962-14.patch | 2.04 KB | xjm |
#14 | interdiff.txt | 861 bytes | xjm |
#10 | 1402962-9-tests.patch | 1.24 KB | xjm |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedComment #2
marcingy CreditAttribution: marcingy commentedlooks good to me.
Comment #3
catchThis is a bit yoda:
FALSE !== $cached_output = drupal_render_cache_get($elements)
Could we do it another way?
Could also use a test for this one.
Comment #4
marcingy CreditAttribution: marcingy commentedNew version with less yoda and a test!
Comment #5
xjmShould be "Tests."
Attached fixes that. Test also uploaded separately to expose the failure.
Comment #6
Tor Arne Thune CreditAttribution: Tor Arne Thune commentedThis made me stop and wonder. Would it be better to say: "Make sure the render process got the cache for the empty render item." ...or have I misunderstood?
Rest looks good :)
Comment #7
xjmThanks @Tor Arne Thune! I'll polish the inline docs a little. Edit: But, um, not at 3a. That could end badly. :)
Comment #8
xjmClarified the inline comments a bit.
Comment #9
aspilicious CreditAttribution: aspilicious commentedLooks good and sane.
Comment #10
xjmchx in IRC:
Fixed here.
Comment #11
chx CreditAttribution: chx commentedI am very happy to see render cache enhancements given how much me (and my client, thanks ITV for sponsoring my time on this review) rely on it.
Comment #12
David_Rothstein CreditAttribution: David_Rothstein commentedShould this be set back to its previous value at the end of the test? (Offhand, I'm not sure how much it matters.)
Comment #13
catchI'm not sure how much it matters either, but I also don't want to find out in three months that it does, so could we do a quick re-roll for that?
Comment #14
xjmSo, uh. Like this?
Comment #15
catchYep.
Comment #16
catchCommitted/pushed to 8.x, thanks folks.
Moving back to 7.x for backport.
Comment #17
oriol_e9gFast port for D7.11 including consideration.
Comment #18
marcingy CreditAttribution: marcingy commentedStraight forward port if the bot comes back green this looks good.
Comment #19
webchickLooks like a straight-up bug fix to me. Thanks for the tests!
Committed and pushed to 7.x.
Comment #21
xjm