Creating default object from empty value I am having issues with a template - in the template.php there is code causing a warning:

Warning: Creating default object from empty value in theme545_preprocess_html() (line 31 of /home/noramtow/public_html/sites/all/themes/theme545/template.php).

The line in questions is this:

$vars['rdf']-&gt;version = 'version="HTML+RDFa 1.1"';


The whole section of code looks like this:

function theme545_preprocess_html(&amp;$vars) {
if (module_exists('rdf')) {
$vars['doctype'] = '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN"&gt;' . "\n";
$vars['rdf']-&gt;version = 'version="HTML+RDFa 1.1"';
$vars['rdf']-&gt;namespaces = $vars['rdf_namespaces'];
$vars['rdf']-&gt;profile = ' profile="' . $vars['grddl_profile'] . '"';
} else {
$vars['doctype'] = '&lt;!DOCTYPE html&gt;' . "\n";
$vars['rdf']-&gt;version = '';
$vars['rdf']-&gt;namespaces = '';
$vars['rdf']-&gt;profile = '';
}
$vars['classes_array'][] = 'body';


I'm not great with PHP - anyone have any idea how to fix this or what's causing it??
Thanks for any help you can give!!
Candace
It sounds like your system wants to make sure $vars['rdf'] is a valid object before assigning properties to it. 

Try adding:

if (empty($variables['rdf']) || !is_object($variables['rdf'])) {
  $vars['rdf'] = new stdClass();
}


Just above your line 31. 

For safety's sake, add it above

if (module_exists('rdf')) {


That way the object will get initialized regardless of whether the RDF module is enabled or not.