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();
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pascalduez’s picture

Actually 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 :

<?xml version="1.0" encoding="ISO-8859-1"?>
<pattern>
	<info>
		[...]
	</info>
	<actions>
		<variables>
			<variable name="cache">1</variable>
			<variable name="cache_lifetime">21600</variable>
			<variable name="page_compression">0</variable>
			<variable name="block_cache">0</variable>
			<variable name="preprocess_css">1</variable>
			<variable name="preprocess_js">1</variable>
			<variable name="error_level">0</variable>
			<variable name="cron_safe_threshold">21600</variable>
		</variables>
		<modules disable="1">
			<module>update</module>
			<module>devel</module>
			<module>views_ui</module> 
			<module>imagecache_ui</module>
			<module>rules_admin</module>
		</modules>
	</actions>
</pattern>
michaek’s picture

That's sort of a strange error - what version of Drupal are you running?

pascalduez’s picture

The latest stable : 6.22

michaek’s picture

Thanks! 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?

pascalduez’s picture

I 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:

Fatal error: Call to undefined function batch_get() in [...]/patterns.module on line 2106
Call Stack
#	Time	Memory	Function	Location
1	0.0005	60648	{main}( )	../index.php:0
2	0.0041	280868	drupal_bootstrap( )	../index.php:15
3	0.0128	642716	_drupal_bootstrap( )	../bootstrap.inc:1109
4	0.0488	3277848	bootstrap_invoke_all( )	../bootstrap.inc:1181
5	0.0503	3278520	module_invoke( )	../bootstrap.inc:680
6	0.0503	3279280	call_user_func_array ( )	../module.inc:461
7	0.0503	3279504	patterns_exit( )	../module.inc:0
 
michaek’s picture

Thanks 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.

davidgrayston’s picture

Priority: Normal » Minor
Status: Active » Needs review
FileSize
554 bytes

Attached is a patch that checks the batch_get() function exists to prevent undefined function errors on cached pages - See comment 5