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.
Hi,
I get a fatal error after running a pattern, and somehow it gets stuck in the page cache, and appears at the bottom of the page. Don't get printed in watchdog. Not displayed when logged-in (no cache).
One of this pattern action is activating the core page cache.
"Fatal error: Call to undefined function batch_get() in [...]/patterns.module on line 2106"
$batch =& batch_get();
Comment | File | Size | Author |
---|---|---|---|
#7 | patterns-page_cache_batch_get-1189118-7.patch | 554 bytes | davidgrayston |
Comments
Comment #1
pascalduez CreditAttribution: pascalduez commentedActually it looks more like a problem with the page cache, as even without running the pattern, but activating the cache manually, I get the error too. Aren't patterns supposed to only run when called from the UI and not on every page call ?
Here's the pattern whose goal is to setup the site for production :
Comment #2
michaek CreditAttribution: michaek commentedThat's sort of a strange error - what version of Drupal are you running?
Comment #3
pascalduez CreditAttribution: pascalduez commentedThe latest stable : 6.22
Comment #4
michaek CreditAttribution: michaek commentedThanks! If the function is missing, it's probably because includes/batch.inc isn't included. I don't thing Patterns includes that explicitly, but perhaps it should.
But that only explains the error's existence - not why it appears on every pageview. It could be that there was an error running patterns that created the message, which was displayed during a normal pageview before it could be displayed at the end of the Patterns run, and was thus cached.
It disappears when you clear the cache? Does it always reappear when you run the pattern?
Comment #5
pascalduez CreditAttribution: pascalduez commentedI tried to clear the cache several times but the error comes back.
Same when re-running the pattern.
But as I said previously, even without running the pattern, but just enabling the core page cache manually, it then appear...
Seems like as soon as the page cache is enabled, the pattern/or the pattern module gets called on each page...
Here's an x-debug trace:
Comment #6
michaek CreditAttribution: michaek commentedThanks for all the information - that's going to make this a lot easier to track down. I'll try to reproduce this, and I'll see about getting a patch in for both issues.
Comment #7
davidgrayston CreditAttribution: davidgrayston commentedAttached is a patch that checks the batch_get() function exists to prevent undefined function errors on cached pages - See comment 5